Skip to content

Commit

Permalink
adds new replace flow to the file block
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu committed Jan 6, 2020
1 parent 6bf89a4 commit a1f2a2b
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions packages/block-library/src/file/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ import {
import {
Animate,
ClipboardButton,
Button,
ToolbarGroup,
withNotices,
} from '@wordpress/components';
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';
import {
BlockControls,
BlockIcon,
MediaUpload,
MediaUploadCheck,
MediaPlaceholder,
MediaReplaceFlow,
RichText,
} from '@wordpress/block-editor';
import { Component } from '@wordpress/element';
Expand Down Expand Up @@ -151,7 +148,6 @@ class FileEdit extends Component {
textLinkTarget,
showDownloadButton,
downloadButtonText,
id,
} = attributes;
const { hasError, showCopyConfirmation } = this.state;
const attachmentPage = media && media.link;
Expand Down Expand Up @@ -189,22 +185,12 @@ class FileEdit extends Component {
} }
/>
<BlockControls>
<MediaUploadCheck>
<ToolbarGroup>
<MediaUpload
onSelect={ this.onSelectFile }
value={ id }
render={ ( { open } ) => (
<Button
className="components-toolbar__control"
label={ __( 'Edit file' ) }
onClick={ open }
icon="edit"
/>
) }
/>
</ToolbarGroup>
</MediaUploadCheck>
<MediaReplaceFlow
mediaURL={ href }
accept="*"
onSelect={ this.onSelectFile }
onError={ this.onUploadError }
/>
</BlockControls>
<Animate type={ isBlobURL( href ) ? 'loading' : null }>
{ ( { className: animateClassName } ) => (
Expand Down

0 comments on commit a1f2a2b

Please sign in to comment.