Skip to content

Commit 956dfea

Browse files
stokesmant-hamano
andauthored
Image Block: omit max width observer element in galleries (#69601)
Unlinked contributors: jupa8712. Co-authored-by: stokesman <[email protected]> Co-authored-by: t-hamano <[email protected]>
1 parent 599d7b0 commit 956dfea

File tree

1 file changed

+3
-3
lines changed
  • packages/block-library/src/image

1 file changed

+3
-3
lines changed

packages/block-library/src/image/edit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export function ImageEdit( {
116116
// Only observe the max width from the parent container when the parent layout is not flex nor grid.
117117
// This won't work for them because the container width changes with the image.
118118
// TODO: Find a way to observe the container width for flex and grid layouts.
119+
const layoutType = parentLayout?.type || parentLayout?.default?.type;
119120
const isMaxWidthContainerWidth =
120-
! parentLayout ||
121-
( parentLayout.type !== 'flex' && parentLayout.type !== 'grid' );
121+
! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );
122122
const [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();
123123

124124
const [ placeholderResizeListener, { width: placeholderWidth } ] =
@@ -452,7 +452,7 @@ export function ImageEdit( {
452452
context={ context }
453453
clientId={ clientId }
454454
blockEditingMode={ blockEditingMode }
455-
parentLayoutType={ parentLayout?.type }
455+
parentLayoutType={ layoutType }
456456
maxContentWidth={ maxContentWidth }
457457
/>
458458
<MediaPlaceholder

0 commit comments

Comments
 (0)