Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media & Text: Remove "Insert from URL" from the replacement flow. #19606

Merged
merged 1 commit into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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