From cad44fdc8d821564e4378d7c9044fae25387213f Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Mon, 9 Dec 2024 16:48:37 +0200 Subject: [PATCH] hide block settings slot in content only and zoom out, allow copy in content only --- .../block-settings-dropdown.js | 34 +++++++++---------- .../editor/src/components/provider/index.js | 19 ++--------- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js index b9caee7c338be..fa0690b357eeb 100644 --- a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js +++ b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js @@ -253,15 +253,13 @@ export function BlockSettingsDropdown( { clientId={ firstBlockClientId } /> ) } - { ( ! isContentOnly || isZoomOut ) && ( - - ) } + { canDuplicate && ( ) } - + { ! isContentOnly && ! isZoomOut && ( + + ) } { typeof children === 'function' ? children( { onClose } ) : Children.map( ( child ) => diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index 68d7bd1d3f4f5..4b8a3b6b23c25 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -13,7 +13,6 @@ import { BlockEditorProvider, BlockContextProvider, privateApis as blockEditorPrivateApis, - store as blockEditorStore, } from '@wordpress/block-editor'; import { store as noticesStore } from '@wordpress/notices'; import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns'; @@ -207,14 +206,6 @@ export const ExperimentalEditorProvider = withRegistryProvider( [ post.type ] ); - const isZoomOut = useSelect( ( select ) => { - const { isZoomOut: _isZoomOut } = unlock( - select( blockEditorStore ) - ); - - return _isZoomOut(); - } ); - const shouldRenderTemplate = !! template && mode !== 'post-only'; const rootLevelPost = shouldRenderTemplate ? template : post; const defaultBlockContext = useMemo( () => { @@ -367,13 +358,9 @@ export const ExperimentalEditorProvider = withRegistryProvider( { children } { ! settings.isPreviewMode && ( <> - { ! isZoomOut && ( - <> - - - - - ) } + + + { mode === 'template-locked' && ( ) }