Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export function ImageEdit( {
// Only observe the max width from the parent container when the parent layout is not flex nor grid.
// This won't work for them because the container width changes with the image.
// TODO: Find a way to observe the container width for flex and grid layouts.
const layoutType = parentLayout?.type || parentLayout?.default?.type;
const isMaxWidthContainerWidth =
! parentLayout ||
( parentLayout.type !== 'flex' && parentLayout.type !== 'grid' );
! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );
const [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();

const [ placeholderResizeListener, { width: placeholderWidth } ] =
Expand Down Expand Up @@ -452,7 +452,7 @@ export function ImageEdit( {
context={ context }
clientId={ clientId }
blockEditingMode={ blockEditingMode }
parentLayoutType={ parentLayout?.type }
parentLayoutType={ layoutType }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn’t required for the fix and affects nothing at present. It just makes sense to pass the resolved value since otherwise the Image component would be getting undefined when inside a Gallery. It doesn’t matter, for now, in that particular case because everything it might affect is subordinate to allowResize that’s provided through context.

maxContentWidth={ maxContentWidth }
/>
<MediaPlaceholder
Expand Down
Loading