Skip to content

Commit

Permalink
Unify media placeholder and upload props within media-text (#17268)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewalczak authored and pinarol committed Aug 30, 2019
1 parent 3db95b7 commit 7aa44a2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/block-library/src/media-text/media-container.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MediaContainer extends Component {
this.onUploadError = this.onUploadError.bind( this );
this.calculateSize = this.calculateSize.bind( this );
this.onLayout = this.onLayout.bind( this );
this.onSelectURL = this.onSelectURL.bind( this );
this.onSelectMediaUploadOption = this.onSelectMediaUploadOption.bind( this );

this.state = {
width: 0,
Expand All @@ -55,13 +55,13 @@ class MediaContainer extends Component {
noticeOperations.createErrorNotice( message );
}

onSelectURL( mediaId, mediaUrl ) {
onSelectMediaUploadOption( { id, url } ) {
const { onSelectMedia } = this.props;

onSelectMedia( {
media_type: 'image',
id: mediaId,
src: mediaUrl,
id,
url,
} );
}

Expand All @@ -71,8 +71,8 @@ class MediaContainer extends Component {
<BlockControls>
<Toolbar>
<MediaUpload
onSelectURL={ this.onSelectURL }
mediaType={ MEDIA_TYPE_IMAGE }
onSelect={ this.onSelectMediaUploadOption }
allowedTypes={ [ MEDIA_TYPE_IMAGE ] }
value={ mediaId }
render={ ( { open } ) => (
<IconButton
Expand Down Expand Up @@ -163,8 +163,8 @@ class MediaContainer extends Component {
labels={ {
title: __( 'Media area' ),
} }
onSelectURL={ this.onSelectURL }
mediaType={ MEDIA_TYPE_IMAGE }
onSelect={ this.onSelectMediaUploadOption }
allowedTypes={ [ MEDIA_TYPE_IMAGE ] }
onFocus={ this.props.onFocus }
/>
);
Expand Down

0 comments on commit 7aa44a2

Please sign in to comment.