Skip to content

Commit

Permalink
Allow content blocks to be explicitly disabled even when they have a …
Browse files Browse the repository at this point in the history
…derived mode
  • Loading branch information
talldan committed Dec 6, 2024
1 parent b15f5e3 commit 2c361c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2327,7 +2327,7 @@ function getDerivedBlockEditingModesForTree(
templatePartClientIds
);
// Allow contentOnly blocks in template parts outside of sections
// to be editable. Only disable blocks that aren't don't fit this criteria.
// to be editable. Only disable blocks that don't fit this criteria.
if ( ! isInTemplatePart && ! isContentBlock( blockName ) ) {
derivedBlockEditingModes.set( clientId, 'disabled' );
return;
Expand Down Expand Up @@ -2369,7 +2369,12 @@ function getDerivedBlockEditingModesForTree(
}
}

if ( blockName && isContentBlock( blockName ) ) {
if (
blockName &&
isContentBlock( blockName ) &&
// Honor the explicit disabled mode for content blocks.
! state.blockEditingModes.get( clientId ) === 'disabled'
) {
derivedBlockEditingModes.set( clientId, 'contentOnly' );
return;
}
Expand Down

0 comments on commit 2c361c7

Please sign in to comment.