Skip to content

Commit

Permalink
Show required slots in content only for Nav block only
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Nov 28, 2024
1 parent ea7ef75 commit 6dc3e44
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions packages/block-editor/src/components/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ const BlockInspectorSingleBlock = ( {
const availableTabs = useInspectorControlsTabs( blockName );
const showTabs = ! isSectionBlock && availableTabs?.length > 1;

// HACK FOR TESTING PURPOSES.
const isNavigationBlock = useSelect(
( select ) => {
const { getBlockName } = select( blockEditorStore );
return getBlockName( clientId ) === 'core/navigation';
},
[ clientId ]
);

const hasBlockStyles = useSelect(
( select ) => {
const { getBlockStyles } = select( blocksStore );
Expand Down Expand Up @@ -266,12 +275,21 @@ const BlockInspectorSingleBlock = ( {
<BlockStylesPanel clientId={ clientId } />
) }

{ contentClientIds && contentClientIds?.length > 0 && (
<PanelBody title={ __( 'Content' ) }>
<BlockQuickNavigation
clientIds={ contentClientIds }
/>
</PanelBody>
{ ! isNavigationBlock &&
contentClientIds &&
contentClientIds?.length > 0 && (
<PanelBody title={ __( 'Content' ) }>
<BlockQuickNavigation
clientIds={ contentClientIds }
/>
</PanelBody>
) }

{ isNavigationBlock && (
<>
<InspectorControls.Slot />
<InspectorControls.Slot group="list" />
</>
) }

{ ! isSectionBlock && (
Expand Down

0 comments on commit 6dc3e44

Please sign in to comment.