diff --git a/packages/block-library/src/embed/edit.js b/packages/block-library/src/embed/edit.js index 97c28876280160..65b181d034cefd 100644 --- a/packages/block-library/src/embed/edit.js +++ b/packages/block-library/src/embed/edit.js @@ -106,7 +106,7 @@ export function getEmbedEditComponent( title, icon, responsive = true ) { } switchBackToURLInput() { - this.setState( { editingURL: true } ); + this.setState( { editingURL: ! this.state.editingURL } ); } getResponsiveHelp( checked ) { @@ -142,16 +142,32 @@ export function getEmbedEditComponent( title, icon, responsive = true ) { // No preview, or we can't embed the current URL, or we've clicked the edit button. if ( ! preview || cannotEmbed || editingURL ) { return ( - this.setState( { url: event.target.value } ) } - fallback={ () => fallback( url, this.props.onReplace ) } - tryAgain={ tryAgain } - /> + <> + + this.setState( { url: event.target.value } ) } + fallback={ () => fallback( url, this.props.onReplace ) } + tryAgain={ tryAgain } + switchBackToURLInput={ this.switchBackToURLInput } + editingURL={ this.state.editingURL } + url={ this.state.url } + /> + ); } @@ -171,6 +187,8 @@ export function getEmbedEditComponent( title, icon, responsive = true ) { <> { const { blockSupportsResponsive, - showEditButton, themeSupportsResponsive, allowResponsive, getResponsiveHelp, toggleResponsive, switchBackToURLInput, + editingURL, + url, } = props; + const editImageIcon = ( ); return ( <> - - { showEditButton && ( - - ) } - + { !! url && ( + + ) } { themeSupportsResponsive && blockSupportsResponsive && ( diff --git a/packages/block-library/src/embed/embed-placeholder.js b/packages/block-library/src/embed/embed-placeholder.js index b532d7b1a84a78..675f0bd7c2f4d4 100644 --- a/packages/block-library/src/embed/embed-placeholder.js +++ b/packages/block-library/src/embed/embed-placeholder.js @@ -6,29 +6,41 @@ import { Button, Placeholder } from '@wordpress/components'; import { BlockIcon } from '@wordpress/block-editor'; const EmbedPlaceholder = ( props ) => { - const { icon, label, value, onSubmit, onChange, cannotEmbed, fallback, tryAgain } = props; + const { icon, label, value, onSubmit, onChange, switchBackToURLInput, cannotEmbed, fallback, tryAgain } = props; return ( } label={ label } className="wp-block-embed"> -
- - - { cannotEmbed && + <> + + + + { cannotEmbed &&

{ __( 'Sorry, this content could not be embedded.' ) }

- } -
+ } + + { value &&
+ +
} +
); };