Skip to content

Commit

Permalink
Zoomed out fixes - content should never be editable in zoomed out, ev…
Browse files Browse the repository at this point in the history
…en synced pattern overrides or when write mode is active
  • Loading branch information
talldan committed Nov 18, 2024
1 parent 4378c0d commit 38a3ab3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2246,8 +2246,8 @@ const withDerivedBlockEditingModes = ( reducer ) => ( state, action ) => {
'contentOnly'
);

// Content is only editable in navigation mode.
if ( isNavMode ) {
// Content is only editable when not zoomed out.
if ( ! isZoomedOut ) {
recurseInnerBlocks(
nextState,
sectionClientId,
Expand Down Expand Up @@ -2303,10 +2303,14 @@ const withDerivedBlockEditingModes = ( reducer ) => ( state, action ) => {
if ( ! isZoomedOut && ! isNavMode ) {
derivedBlockEditingModes.set( clientId, 'contentOnly' );
}
// Zoomed out doesn't allow content editing, so don't try enabling
// inner blocks.
recurseInnerBlocks( nextState, clientId, ( block ) => {
// If an inner block has bindings, it should be set to contentOnly.
// Else it should be set to disabled.
if ( hasBindings( block ) ) {
// Also check for zoomed out - content shouldn't be editable when
// zoomed out, but to be rigorous, still disable inner blocks.
if ( ! isZoomedOut && hasBindings( block ) ) {
derivedBlockEditingModes.set(
block.clientId,
'contentOnly'
Expand Down

0 comments on commit 38a3ab3

Please sign in to comment.