Skip to content

Commit

Permalink
Avoid special content only settings menu in Zoom Out
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Oct 24, 2024
1 parent 6015e32 commit 0befd2f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ 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';
Expand Down Expand Up @@ -188,6 +189,15 @@ export const ExperimentalEditorProvider = withRegistryProvider(
},
[ post.type ]
);

const isZoomOut = useSelect( ( select ) => {
const { __unstableGetEditorMode } = unlock(
select( blockEditorStore )
);

return __unstableGetEditorMode() === 'zoom-out';
} );

const shouldRenderTemplate = !! template && mode !== 'post-only';
const rootLevelPost = shouldRenderTemplate ? template : post;
const defaultBlockContext = useMemo( () => {
Expand Down Expand Up @@ -334,7 +344,9 @@ export const ExperimentalEditorProvider = withRegistryProvider(
<>
<PatternsMenuItems />
<TemplatePartMenuItems />
<ContentOnlySettingsMenu />
{ ! isZoomOut && (
<ContentOnlySettingsMenu />
) }
{ mode === 'template-locked' && (
<DisableNonPageContentBlocks />
) }
Expand Down

0 comments on commit 0befd2f

Please sign in to comment.