diff --git a/packages/block-editor/src/components/block-settings-menu-controls/index.js b/packages/block-editor/src/components/block-settings-menu-controls/index.js index 8b43827605c53e..d043ae34aa0d27 100644 --- a/packages/block-editor/src/components/block-settings-menu-controls/index.js +++ b/packages/block-editor/src/components/block-settings-menu-controls/index.js @@ -27,15 +27,20 @@ import { BlockRenameControl, useBlockRename } from '../block-rename'; const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' ); const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => { - const { selectedBlocks, selectedClientIds } = useSelect( + const { selectedBlocks, selectedClientIds, isContentOnly } = useSelect( ( select ) => { - const { getBlockNamesByClientId, getSelectedBlockClientIds } = - select( blockEditorStore ); + const { + getBlockNamesByClientId, + getSelectedBlockClientIds, + getBlockEditingMode, + } = select( blockEditorStore ); const ids = clientIds !== null ? clientIds : getSelectedBlockClientIds(); return { selectedBlocks: getBlockNamesByClientId( ids ), selectedClientIds: ids, + isContentOnly: + getBlockEditingMode( ids[ 0 ] ) === 'contentOnly', }; }, [ clientIds ] @@ -43,8 +48,10 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => { const { canLock } = useBlockLock( selectedClientIds[ 0 ] ); const { canRename } = useBlockRename( selectedBlocks[ 0 ] ); - const showLockButton = selectedClientIds.length === 1 && canLock; - const showRenameButton = selectedClientIds.length === 1 && canRename; + const showLockButton = + selectedClientIds.length === 1 && canLock && ! isContentOnly; + const showRenameButton = + selectedClientIds.length === 1 && canRename && ! isContentOnly; // Check if current selection of blocks is Groupable or Ungroupable // and pass this props down to ConvertToGroupButton. diff --git a/packages/block-editor/src/components/list-view/block-select-button.js b/packages/block-editor/src/components/list-view/block-select-button.js index e52fc693afa79d..539fd768caa3b1 100644 --- a/packages/block-editor/src/components/list-view/block-select-button.js +++ b/packages/block-editor/src/components/list-view/block-select-button.js @@ -58,6 +58,15 @@ function ListViewBlockSelectButton( context: 'list-view', } ); const { isLocked } = useBlockLock( clientId ); + const { isContentOnly } = useSelect( + ( select ) => ( { + isContentOnly: + select( blockEditorStore ).getBlockEditingMode( clientId ) === + 'contentOnly', + } ), + [ clientId ] + ); + const shouldShowLockIcon = isLocked && ! isContentOnly; const { canInsertBlockType, getSelectedBlockClientIds, @@ -339,7 +348,7 @@ function ListViewBlockSelectButton( ) ) } ) : null } - { isLocked && ( + { shouldShowLockIcon && ( diff --git a/packages/block-editor/src/components/list-view/block.js b/packages/block-editor/src/components/list-view/block.js index 930d0a0f80ef66..9ae6d97d63edf4 100644 --- a/packages/block-editor/src/components/list-view/block.js +++ b/packages/block-editor/src/components/list-view/block.js @@ -107,8 +107,8 @@ function ListViewBlock( { // since that menu is part of the toolbar in the editor canvas. // List View respects this by also hiding the block settings menu. hasBlockSupport( blockName, '__experimentalToolbar', true ) && - // Don't show the settings menu if block is disabled or content only. - blockEditingMode === 'default'; + // Don't show the settings menu if block is disabled. + blockEditingMode !== 'disabled'; const instanceId = useInstanceId( ListViewBlock ); const descriptionId = `list-view-block-select-button__description-${ instanceId }`;