From 2c361c77d047c2859f737cffa309eef28389a79c Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Fri, 6 Dec 2024 15:14:03 +0800 Subject: [PATCH] Allow content blocks to be explicitly disabled even when they have a derived mode --- packages/block-editor/src/store/reducer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/store/reducer.js b/packages/block-editor/src/store/reducer.js index 2765959a8333f8..597b53a89d5b1e 100644 --- a/packages/block-editor/src/store/reducer.js +++ b/packages/block-editor/src/store/reducer.js @@ -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; @@ -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; }