From 7293615557c7718f8f54d49befa3d0a81c6eba3d Mon Sep 17 00:00:00 2001 From: ramon Date: Wed, 4 Sep 2024 15:05:18 +1000 Subject: [PATCH] Rename selectedHasTemplateLock to hasContentOnlyLocking. In the block-switcher, only hide the drop down if a selected block is content locked. --- .../src/components/block-switcher/index.js | 11 +++++++---- .../src/components/block-toolbar/index.js | 6 +++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/block-switcher/index.js b/packages/block-editor/src/components/block-switcher/index.js index 610f2c0580b5b7..98e7f7b2d21420 100644 --- a/packages/block-editor/src/components/block-switcher/index.js +++ b/packages/block-editor/src/components/block-switcher/index.js @@ -198,7 +198,7 @@ const BlockIndicator = ( { icon, showTitle, blockTitle } ) => ( export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => { const { - selectedHasTemplateLock, + hasContentOnlyLocking, canRemove, hasBlockStyles, icon, @@ -255,7 +255,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => { _isSingleBlockSelected && isReusableBlock( _blocks[ 0 ] ), isTemplate: _isSingleBlockSelected && isTemplatePart( _blocks[ 0 ] ), - selectedHasTemplateLock: _hasTemplateLock, + hasContentOnlyLocking: _hasTemplateLock, }; }, [ clientIds ] @@ -265,7 +265,7 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => { maximumLength: 35, } ); - if ( invalidBlocks || selectedHasTemplateLock ) { + if ( invalidBlocks ) { return null; } @@ -274,7 +274,10 @@ export const BlockSwitcher = ( { clientIds, disabled, isUsingBindings } ) => { ? blockTitle : __( 'Multiple blocks selected' ); - const hideDropdown = disabled || ( ! hasBlockStyles && ! canRemove ); + const hideDropdown = + disabled || + ( ! hasBlockStyles && ! canRemove ) || + hasContentOnlyLocking; if ( hideDropdown ) { return ( diff --git a/packages/block-editor/src/components/block-toolbar/index.js b/packages/block-editor/src/components/block-toolbar/index.js index aa1d00b79fb1d3..95be157c6bb713 100644 --- a/packages/block-editor/src/components/block-toolbar/index.js +++ b/packages/block-editor/src/components/block-toolbar/index.js @@ -66,7 +66,7 @@ export function PrivateBlockToolbar( { showParentSelector, isUsingBindings, hasParentPattern, - selectedHasTemplateLock, + hasContentOnlyLocking, } = useSelect( ( select ) => { const { getBlockName, @@ -129,7 +129,7 @@ export function PrivateBlockToolbar( { _isDefaultEditingMode, isUsingBindings: _isUsingBindings, hasParentPattern: _hasParentPattern, - selectedHasTemplateLock: _hasTemplateLock, + hasContentOnlyLocking: _hasTemplateLock, }; }, [] ); @@ -212,7 +212,7 @@ export function PrivateBlockToolbar( { ) } - { ! selectedHasTemplateLock && + { ! hasContentOnlyLocking && shouldShowVisualToolbar && isMultiToolbar && } { shouldShowVisualToolbar && (