Skip to content

Commit 4ea2fd1

Browse files
authored
fix (posts block): fix image width in horizontal block styles (#3649)
* update selector callback * only disable save width when unit is % * fix typo
1 parent 56b250f commit 4ea2fd1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/block/posts/style.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,10 @@ Image.addStyles( blockStyles, {
287287
const blockStyle = getBlockStyle( variations, className )
288288

289289
if ( [ 'horizontal', 'horizontal-2' ].includes( blockStyle?.name ) ) {
290-
if ( imageHasLink ) {
290+
// If the image has a link and the width unit is %, return false
291+
// because we have set a custom selector for the image width that uses the % unit.
292+
if ( imageHasLink && ( getAttribute( 'imageWidthUnit' ) === '%' ||
293+
getAttribute( 'imageWidthUnitTablet' ) === '%' ) ) {
291294
return false
292295
}
293296
return true

0 commit comments

Comments
 (0)