diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js index 7690386764f6c..deef2d75386fd 100644 --- a/packages/block-editor/src/components/block-list/block.js +++ b/packages/block-editor/src/components/block-list/block.js @@ -555,7 +555,7 @@ function BlockListBlockProvider( props ) { const typing = isTyping(); const hasLightBlockWrapper = blockType?.apiVersion > 1; const movingClientId = hasBlockMovingClientId(); - + const blockEditingMode = getBlockEditingMode( clientId ); return { mode: getBlockMode( clientId ), isSelectionEnabled: isSelectionEnabled(), @@ -574,7 +574,7 @@ function BlockListBlockProvider( props ) { themeSupportsLayout: supportsLayout, isTemporarilyEditingAsBlocks: __unstableGetTemporarilyEditingAsBlocks() === clientId, - blockEditingMode: getBlockEditingMode( clientId ), + blockEditingMode, mayDisplayControls: _isSelected || ( isFirstMultiSelectedBlock( clientId ) && @@ -590,7 +590,9 @@ function BlockListBlockProvider( props ) { index: getBlockIndex( clientId ), blockApiVersion: blockType?.apiVersion || 1, blockTitle: match?.title || blockType?.title, - isSubtreeDisabled: isBlockSubtreeDisabled( clientId ), + isSubtreeDisabled: + blockEditingMode === 'disabled' && + isBlockSubtreeDisabled( clientId ), isOutlineEnabled: outlineMode, hasOverlay: __unstableHasActiveBlockOverlayActive( clientId ), initialPosition: @@ -614,8 +616,7 @@ function BlockListBlockProvider( props ) { getBlockName( movingClientId ), getBlockRootClientId( clientId ) ), - isEditingDisabled: - getBlockEditingMode( clientId ) === 'disabled', + isEditingDisabled: blockEditingMode === 'disabled', className: hasLightBlockWrapper ? attributes.className : undefined, diff --git a/packages/block-editor/src/store/private-selectors.js b/packages/block-editor/src/store/private-selectors.js index caca9507f0770..da32272c8ff23 100644 --- a/packages/block-editor/src/store/private-selectors.js +++ b/packages/block-editor/src/store/private-selectors.js @@ -45,13 +45,13 @@ export function getLastInsertedBlocksClientIds( state ) { } /** - * Returns true if the block with the given client ID and all of its descendants + * Returns true if all of the descendants of a block with the given client ID * have an editing mode of 'disabled', or false otherwise. * * @param {Object} state Global application state. * @param {string} clientId The block client ID. * - * @return {boolean} Whether the block and its descendants are disabled. + * @return {boolean} Whether the block descendants are disabled. */ export const isBlockSubtreeDisabled = createSelector( ( state, clientId ) => { @@ -63,10 +63,7 @@ export const isBlockSubtreeDisabled = createSelector( ) ); }; - return ( - getBlockEditingMode( state, clientId ) === 'disabled' && - getBlockOrder( state, clientId ).every( isChildSubtreeDisabled ) - ); + return getBlockOrder( state, clientId ).every( isChildSubtreeDisabled ); }, ( state ) => [ state.blocks.parents,