Skip to content

Commit

Permalink
Fix flash of content when in zoom out mode
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Sep 19, 2024
1 parent cf9040d commit 388cae1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,20 @@ export function getPatternBlockEditingMode( state, clientId ) {
return 'disabled';
}

// Make the outer pattern block content only mode.
if (
getBlockName( state, clientId ) === 'core/block' &&
parentPatternCount === 0
) {
return 'contentOnly';
}

// Disable pattern content in zoom-out mode.
const isZoomOut = isZoomOutMode( state );
if ( isZoomOut ) {
return 'disabled';
}

// If the block has a binding of any kind, allow content only editing.
const attributes = getBlockAttributes( state, clientId );
if ( Object.keys( attributes.metadata?.bindings ?? {} )?.length > 0 ) {
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/block/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ function ReusableBlockEdit( {
} );

const innerBlocksProps = useInnerBlocksProps( blockProps, {
templateLock: 'all',
layout,
value: blocks,
onInput: NOOP,
Expand Down

0 comments on commit 388cae1

Please sign in to comment.