From 78fffa7ff0e2c19ac2891633f251f6470dae045b Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Wed, 27 Nov 2024 16:23:20 +0200 Subject: [PATCH] keep only copy, duplicate and delete in the more menu (#67279) Co-authored-by: draganescu Co-authored-by: getdave Co-authored-by: ellatrix Co-authored-by: richtabor Co-authored-by: annezazu --- .../block-settings-menu-controls/index.js | 3 ++- .../block-settings-dropdown.js | 7 ++++++- .../editor/src/components/provider/index.js | 20 ++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) 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 4ebce4172e9b37..b0755be4c26297 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 @@ -55,7 +55,8 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => { const convertToGroupButtonProps = useConvertToGroupButtonProps( selectedClientIds ); const { isGroupable, isUngroupable } = convertToGroupButtonProps; - const showConvertToGroupButton = isGroupable || isUngroupable; + const showConvertToGroupButton = + ( isGroupable || isUngroupable ) && ! isContentOnly; return ( { const { @@ -74,6 +76,7 @@ export function BlockSettingsDropdown( { getBlockAttributes, getOpenedBlockSettingsMenu, getBlockEditingMode, + isZoomOut: _isZoomOut, } = unlock( select( blockEditorStore ) ); const { getActiveBlockVariation } = select( blocksStore ); @@ -98,10 +101,12 @@ export function BlockSettingsDropdown( { openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), isContentOnly: getBlockEditingMode( firstBlockClientId ) === 'contentOnly', + isZoomOut: _isZoomOut(), }; }, [ firstBlockClientId ] ); + const { getBlockOrder, getSelectedBlockClientIds } = useSelect( blockEditorStore ); @@ -248,7 +253,7 @@ export function BlockSettingsDropdown( { clientId={ firstBlockClientId } /> ) } - { ! isContentOnly && ( + { ( ! isContentOnly || isZoomOut ) && ( { + const { isZoomOut: _isZoomOut } = unlock( + select( blockEditorStore ) + ); + + return _isZoomOut(); + } ); + const shouldRenderTemplate = !! template && mode !== 'post-only'; const rootLevelPost = shouldRenderTemplate ? template : post; const defaultBlockContext = useMemo( () => { @@ -357,9 +367,13 @@ export const ExperimentalEditorProvider = withRegistryProvider( { children } { ! settings.isPreviewMode && ( <> - - - + { ! isZoomOut && ( + <> + + + + + ) } { mode === 'template-locked' && ( ) }