diff --git a/packages/block-library/src/image/edit.js b/packages/block-library/src/image/edit.js index 5471dcb0a82ccd..e20e497c1122f1 100644 --- a/packages/block-library/src/image/edit.js +++ b/packages/block-library/src/image/edit.js @@ -83,7 +83,7 @@ const isTemporaryImage = ( id, url ) => ! id && isBlobURL( url ); const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url ); class ImageEdit extends Component { - constructor() { + constructor( { attributes } ) { super( ...arguments ); this.updateAlt = this.updateAlt.bind( this ); this.updateAlignment = this.updateAlignment.bind( this ); @@ -101,7 +101,7 @@ class ImageEdit extends Component { this.state = { captionFocused: false, - isEditing: ! this.props.attributes.url, + isEditing: ! attributes.url, }; } @@ -461,7 +461,7 @@ class ImageEdit extends Component { // Disable reason: Image itself is not meant to be // interactive, but should direct focus to block // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions - const img = ( { ); + const img = {; if ( ! isResizable || ! imageWidthWithinContainer ) { return ( diff --git a/packages/editor/src/components/media-placeholder/index.js b/packages/editor/src/components/media-placeholder/index.js index ad8d79a4fc12d5..ba53f6ce54c0b7 100644 --- a/packages/editor/src/components/media-placeholder/index.js +++ b/packages/editor/src/components/media-placeholder/index.js @@ -25,6 +25,30 @@ import MediaUpload from '../media-upload'; import URLPopover from '../url-popover'; import { mediaUpload } from '../../utils/'; +const InsertFromURLPopover = ( { src, onChange, onSubmit, onClose } ) => ( + +
+ + + +
+); + class MediaPlaceholder extends Component { constructor() { super( ...arguments ); @@ -129,10 +153,9 @@ class MediaPlaceholder extends Component { const { isURLInputVisible, + src, } = this.state; - const toggleURLInput = ! isURLInputVisible ? this.openURLInput : undefined; - const allowedTypes = this.getAllowedTypes(); return ( @@ -174,38 +197,22 @@ class MediaPlaceholder extends Component { ) } /> { onSelectURL && ( -
+
{ isURLInputVisible && ( - -
- - - -
+ ) }
) } diff --git a/packages/editor/src/components/url-popover/index.js b/packages/editor/src/components/url-popover/index.js index d40874deaa9c79..c89f76d8bfd626 100644 --- a/packages/editor/src/components/url-popover/index.js +++ b/packages/editor/src/components/url-popover/index.js @@ -30,7 +30,7 @@ class URLPopover extends Component { children, renderSettings, onClose, - onClickOutside = onClose, + onClickOutside, position = 'bottom center', focusOnMount = 'firstElement', } = this.props;