Skip to content

Commit

Permalink
Remove onSelectURL (#19606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Soean authored and draganescu committed Jan 14, 2020
1 parent adf6735 commit 4a3ac85
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
25 changes: 0 additions & 25 deletions packages/block-library/src/media-text/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class MediaTextEdit extends Component {
mediaWidth: null,
};
this.onSetHref = this.onSetHref.bind( this );
this.onSelectURL = this.onSelectURL.bind( this );
}

onSelectMedia( media ) {
Expand Down Expand Up @@ -118,29 +117,6 @@ class MediaTextEdit extends Component {
this.props.setAttributes( props );
}

onSelectURL( newURL ) {
const { mediaUrl, linkDestination, href } = this.props.attributes;

if ( newURL !== mediaUrl ) {
let newHref = href;
if ( linkDestination === LINK_DESTINATION_MEDIA ) {
// Update the media link.
newHref = newURL;
}

// Check if the image is linked to the attachment page.
if ( linkDestination === LINK_DESTINATION_ATTACHMENT ) {
// Update the media link.
newHref = undefined;
}
this.props.setAttributes( {
mediaUrl: newURL,
href: newHref,
mediaId: undefined,
} );
}
}

commitWidthChange( width ) {
const { setAttributes } = this.props;

Expand All @@ -159,7 +135,6 @@ class MediaTextEdit extends Component {
<MediaContainer
className="block-library-media-text__media-container"
onSelectMedia={ this.onSelectMedia }
onSelectURL={ this.onSelectURL }
onWidthChange={ this.onWidthChange }
commitWidthChange={ this.commitWidthChange }
{ ...{ mediaAlt, mediaId, mediaType, mediaUrl, mediaPosition, mediaWidth, imageFill, focalPoint } }
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/media-text/media-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,14 @@ class MediaContainer extends Component {
}

renderToolbarEditButton() {
const { onSelectMedia, onSelectURL, mediaUrl } = this.props;
const { onSelectMedia, mediaUrl } = this.props;
return (
<BlockControls>
<MediaReplaceFlow
mediaURL={ mediaUrl }
allowedTypes={ ALLOWED_MEDIA_TYPES }
accept="image/*,video/*"
onSelect={ onSelectMedia }
onSelectURL={ onSelectURL }
/>
</BlockControls>
);
Expand Down

0 comments on commit 4a3ac85

Please sign in to comment.