Skip to content

Commit

Permalink
Zoom Out: Hide slots and grouping buttons (#66243)
Browse files Browse the repository at this point in the history
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: ajlende <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: richtabor <[email protected]>
  • Loading branch information
8 people authored Oct 18, 2024
1 parent ec9625e commit 1bfac71
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export function PrivateBlockToolbar( {
hasParentPattern,
hasContentOnlyLocking,
showShuffleButton,
showSlots,
showGroupButtons,
showLockButtons,
} = useSelect( ( select ) => {
const {
getBlockName,
Expand Down Expand Up @@ -135,6 +138,9 @@ export function PrivateBlockToolbar( {
hasParentPattern: _hasParentPattern,
hasContentOnlyLocking: _hasTemplateLock,
showShuffleButton: isZoomOut(),
showSlots: ! isZoomOut(),
showGroupButtons: ! isZoomOut(),
showLockButtons: ! isZoomOut(),
};
}, [] );

Expand Down Expand Up @@ -195,11 +201,13 @@ export function PrivateBlockToolbar( {
>
<ToolbarGroup className="block-editor-block-toolbar__block-controls">
<BlockSwitcher clientIds={ blockClientIds } />
{ ! isMultiToolbar && isDefaultEditingMode && (
<BlockLockToolbar
clientId={ blockClientId }
/>
) }
{ ! isMultiToolbar &&
isDefaultEditingMode &&
showLockButtons && (
<BlockLockToolbar
clientId={ blockClientId }
/>
) }
<BlockMover
clientIds={ blockClientIds }
hideDragHandle={ hideDragHandle }
Expand All @@ -209,7 +217,8 @@ export function PrivateBlockToolbar( {
) }
{ ! hasContentOnlyLocking &&
shouldShowVisualToolbar &&
isMultiToolbar && <BlockGroupToolbar /> }
isMultiToolbar &&
showGroupButtons && <BlockGroupToolbar /> }
{ showShuffleButton && (
<ToolbarGroup>
<Shuffle
Expand All @@ -218,7 +227,7 @@ export function PrivateBlockToolbar( {
/>
</ToolbarGroup>
) }
{ shouldShowVisualToolbar && (
{ shouldShowVisualToolbar && showSlots && (
<>
<BlockControls.Slot
group="parent"
Expand Down

0 comments on commit 1bfac71

Please sign in to comment.