Skip to content

Commit

Permalink
Use block editing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Jun 13, 2024
1 parent 7f343d7 commit ce14a1c
Showing 1 changed file with 22 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function BlockSettingsDropdown( {
selectedBlockClientIds,
openedBlockSettingsMenu,
isContentOnly,
hasPatternParent,
} = useSelect(
( select ) => {
const {
Expand All @@ -76,7 +75,6 @@ export function BlockSettingsDropdown( {
getBlockAttributes,
getOpenedBlockSettingsMenu,
getBlockEditingMode,
getBlockParentsByBlockName,
} = unlock( select( blockEditorStore ) );

const { getActiveBlockVariation } = select( blocksStore );
Expand All @@ -102,11 +100,6 @@ export function BlockSettingsDropdown( {
openedBlockSettingsMenu: getOpenedBlockSettingsMenu(),
isContentOnly:
getBlockEditingMode( firstBlockClientId ) === 'contentOnly',
hasPatternParent: !! getBlockParentsByBlockName(
firstBlockClientId,
'core/block',
true
),
};
},
[ firstBlockClientId ]
Expand Down Expand Up @@ -263,34 +256,28 @@ export function BlockSettingsDropdown( {
{ __( 'Duplicate' ) }
</MenuItem>
) }
{ canInsertBlock &&
// Don't show "insert before/after" for pattern overrides blocks.
! ( isContentOnly && hasPatternParent ) && (
<>
<MenuItem
onClick={ pipe(
onClose,
onInsertBefore
) }
shortcut={
shortcuts.insertBefore
}
>
{ __( 'Add before' ) }
</MenuItem>
<MenuItem
onClick={ pipe(
onClose,
onInsertAfter
) }
shortcut={
shortcuts.insertAfter
}
>
{ __( 'Add after' ) }
</MenuItem>
</>
) }
{ canInsertBlock && ! isContentOnly && (
<>
<MenuItem
onClick={ pipe(
onClose,
onInsertBefore
) }
shortcut={ shortcuts.insertBefore }
>
{ __( 'Add before' ) }
</MenuItem>
<MenuItem
onClick={ pipe(
onClose,
onInsertAfter
) }
shortcut={ shortcuts.insertAfter }
>
{ __( 'Add after' ) }
</MenuItem>
</>
) }
</MenuGroup>
{ canCopyStyles && ! isContentOnly && (
<MenuGroup>
Expand Down

0 comments on commit ce14a1c

Please sign in to comment.