Skip to content

Commit

Permalink
hide block settings slot in content only and zoom out, allow copy in …
Browse files Browse the repository at this point in the history
…content only
  • Loading branch information
draganescu committed Dec 9, 2024
1 parent e772438 commit cad44fd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,13 @@ export function BlockSettingsDropdown( {
clientId={ firstBlockClientId }
/>
) }
{ ( ! isContentOnly || isZoomOut ) && (
<CopyMenuItem
clientIds={ clientIds }
onCopy={ onCopy }
shortcut={ displayShortcut.primary(
'c'
) }
/>
) }
<CopyMenuItem
clientIds={ clientIds }
onCopy={ onCopy }
shortcut={ displayShortcut.primary(
'c'
) }
/>
{ canDuplicate && (
<MenuItem
onClick={ pipe(
Expand Down Expand Up @@ -316,14 +314,16 @@ export function BlockSettingsDropdown( {
</MenuItem>
</MenuGroup>
) }
<BlockSettingsMenuControls.Slot
fillProps={ {
onClose,
count,
firstBlockClientId,
} }
clientIds={ clientIds }
/>
{ ! isContentOnly && ! isZoomOut && (
<BlockSettingsMenuControls.Slot
fillProps={ {
onClose,
count,
firstBlockClientId,
} }
clientIds={ clientIds }
/>
) }
{ typeof children === 'function'
? children( { onClose } )
: Children.map( ( child ) =>
Expand Down
19 changes: 3 additions & 16 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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( () => {
Expand Down Expand Up @@ -367,13 +358,9 @@ export const ExperimentalEditorProvider = withRegistryProvider(
{ children }
{ ! settings.isPreviewMode && (
<>
{ ! isZoomOut && (
<>
<PatternsMenuItems />
<TemplatePartMenuItems />
<ContentOnlySettingsMenu />
</>
) }
<PatternsMenuItems />
<TemplatePartMenuItems />
<ContentOnlySettingsMenu />
{ mode === 'template-locked' && (
<DisableNonPageContentBlocks />
) }
Expand Down

0 comments on commit cad44fd

Please sign in to comment.