diff --git a/edit-post/assets/stylesheets/_z-index.scss b/edit-post/assets/stylesheets/_z-index.scss index 9a350e6868e7f6..480e8b098083c1 100644 --- a/edit-post/assets/stylesheets/_z-index.scss +++ b/edit-post/assets/stylesheets/_z-index.scss @@ -25,7 +25,7 @@ $z-layers: ( ".editor-url-input__suggestions": 30, ".edit-post-header": 30, ".block-library-button__inline-link .editor-url-input__suggestions": 6, // URL suggestions for button block above sibling inserter - ".wp-block-image__resize-handlers": 1, // Resize handlers above sibling inserter + ".block-library-image__resize-handlers": 1, // Resize handlers above sibling inserter // Side UI active buttons ".editor-block-settings-remove": 1, diff --git a/packages/block-library/src/image/edit.js b/packages/block-library/src/image/edit.js index ec839709e22f63..2ae93346c923c6 100644 --- a/packages/block-library/src/image/edit.js +++ b/packages/block-library/src/image/edit.js @@ -432,6 +432,7 @@ class ImageEdit extends Component { { getInspectorControls( imageWidth, imageHeight ) } ); - return ( -
+ const figure = ( + { href ? { image } : image } { caption && caption.length > 0 && } + + ); + + if ( 'left' === align || 'right' === align || 'center' === align ) { + return ( +
+
+ { figure } +
+
+ ); + } + + return ( +
+ { figure }
); }, deprecated: [ + { + attributes: blockAttributes, + save( { attributes } ) { + const { url, alt, caption, align, href, width, height, id } = attributes; + + const classes = classnames( { + [ `align${ align }` ]: align, + 'is-resized': width || height, + } ); + + const image = ( + { + ); + + return ( +
+ { href ? { image } : image } + { caption && caption.length > 0 && } +
+ ); + }, + }, { attributes: blockAttributes, save( { attributes } ) { diff --git a/packages/block-library/src/image/style.scss b/packages/block-library/src/image/style.scss index 321fc30504bc3c..4922b92449f5b9 100644 --- a/packages/block-library/src/image/style.scss +++ b/packages/block-library/src/image/style.scss @@ -1,5 +1,4 @@ .wp-block-image { - width: fit-content; max-width: 100%; img { @@ -7,31 +6,41 @@ } &.aligncenter { - display: block; - margin-left: auto; - margin-right: auto; text-align: center; } - &.is-resized { - width: min-content; + &.alignfull img, + &.alignwide img { + width: 100%; + } - // Emulate min-content for Edge and IE11 - display: -ms-inline-grid; - -ms-grid-columns: min-content; + // Floats get an extra wrapping