|
|
|
@ -27,7 +27,6 @@ class Upload extends ImmutablePureComponent {
|
|
|
|
|
onDescriptionChange: PropTypes.func.isRequired,
|
|
|
|
|
onOpenFocalPoint: PropTypes.func.isRequired,
|
|
|
|
|
onSubmit: PropTypes.func.isRequired,
|
|
|
|
|
features: PropTypes.object,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
state = {
|
|
|
|
@ -87,6 +86,10 @@ class Upload extends ImmutablePureComponent {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleOpenModal = () => {
|
|
|
|
|
this.props.onOpenModal(this.props.media);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { intl, media } = this.props;
|
|
|
|
|
const active = this.state.hovered || this.state.focused;
|
|
|
|
@ -105,12 +108,12 @@ class Upload extends ImmutablePureComponent {
|
|
|
|
|
className={classNames('compose-form__upload-thumbnail', `${mediaType}`)}
|
|
|
|
|
style={{
|
|
|
|
|
transform: `scale(${scale})`,
|
|
|
|
|
backgroundImage: (mediaType !== 'video' && mediaType !== 'audio' ? `url(${media.get('preview_url')})` : null),
|
|
|
|
|
backgroundImage: mediaType === 'image' ? `url(${media.get('preview_url')})`: null,
|
|
|
|
|
backgroundPosition: `${x}% ${y}%` }}
|
|
|
|
|
>
|
|
|
|
|
<div className={classNames('compose-form__upload__actions', { active })}>
|
|
|
|
|
<button className='icon-button' onClick={this.handleUndoClick}><Icon id='times' /> <FormattedMessage id='upload_form.undo' defaultMessage='Delete' /></button>
|
|
|
|
|
{this.props.features.focalPoint && media.get('type') === 'image' && <button className='icon-button' onClick={this.handleFocalPointClick}><Icon id='crosshairs' /> <FormattedMessage id='upload_form.focus' defaultMessage='Change preview' /></button>}
|
|
|
|
|
<button className='icon-button' onClick={this.handleOpenModal}><Icon id='search-plus' /> <FormattedMessage id='upload_form.preview' defaultMessage='Preview' /></button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className={classNames('compose-form__upload-description', { active })}>
|
|
|
|
@ -128,6 +131,14 @@ class Upload extends ImmutablePureComponent {
|
|
|
|
|
/>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className='compose-form__upload-preview'>
|
|
|
|
|
{mediaType === 'video' && (
|
|
|
|
|
<video autoPlay playsInline muted loop>
|
|
|
|
|
<source src={media.get('preview_url')} />
|
|
|
|
|
</video>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</Motion>
|
|
|
|
|