From ce14a1c0ee71ad9d349f38781415cb65ecacdd7c Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Thu, 13 Jun 2024 18:52:57 +0800 Subject: [PATCH] Use block editing mode --- .../block-settings-dropdown.js | 57 +++++++------------ 1 file changed, 22 insertions(+), 35 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 f1c1188fd7845..069bd2c9ff1ee 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 @@ -64,7 +64,6 @@ export function BlockSettingsDropdown( { selectedBlockClientIds, openedBlockSettingsMenu, isContentOnly, - hasPatternParent, } = useSelect( ( select ) => { const { @@ -76,7 +75,6 @@ export function BlockSettingsDropdown( { getBlockAttributes, getOpenedBlockSettingsMenu, getBlockEditingMode, - getBlockParentsByBlockName, } = unlock( select( blockEditorStore ) ); const { getActiveBlockVariation } = select( blocksStore ); @@ -102,11 +100,6 @@ export function BlockSettingsDropdown( { openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), isContentOnly: getBlockEditingMode( firstBlockClientId ) === 'contentOnly', - hasPatternParent: !! getBlockParentsByBlockName( - firstBlockClientId, - 'core/block', - true - ), }; }, [ firstBlockClientId ] @@ -263,34 +256,28 @@ export function BlockSettingsDropdown( { { __( 'Duplicate' ) } ) } - { canInsertBlock && - // Don't show "insert before/after" for pattern overrides blocks. - ! ( isContentOnly && hasPatternParent ) && ( - <> - - { __( 'Add before' ) } - - - { __( 'Add after' ) } - - - ) } + { canInsertBlock && ! isContentOnly && ( + <> + + { __( 'Add before' ) } + + + { __( 'Add after' ) } + + + ) } { canCopyStyles && ! isContentOnly && (