Skip to content

Commit

Permalink
Use contextual toolbar in the zoom-out mode (#56808)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Dec 6, 2023
1 parent ddb378f commit 0bc014c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default function SelectedBlockTools( {
resize={ false }
{ ...popoverProps }
>
{ shouldShowContextualToolbar && (
{ shouldShowContextualToolbar ? (
<BlockContextualToolbar
// If the toolbar is being shown because of being forced
// it should focus the toolbar right after the mount.
Expand All @@ -112,12 +112,13 @@ export default function SelectedBlockTools( {
initialToolbarItemIndexRef.current = index;
} }
/>
) }
{ shouldShowBreadcrumb && (
<BlockSelectionButton
clientId={ clientId }
rootClientId={ rootClientId }
/>
) : (
shouldShowBreadcrumb && (
<BlockSelectionButton
clientId={ clientId }
rootClientId={ rootClientId }
/>
)
) }
</BlockPopover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function useShouldContextualToolbarShow() {
} = unlock( select( blockEditorStore ) );

const isEditMode = __unstableGetEditorMode() === 'edit';
const isZoomOutMode = __unstableGetEditorMode() === 'zoom-out';
const hasFixedToolbar = getSettings().hasFixedToolbar;
const isDistractionFree = getSettings().isDistractionFree;
const selectedBlockId =
Expand All @@ -49,7 +50,7 @@ export function useShouldContextualToolbarShow() {
);

const _shouldShowContextualToolbar =
isEditMode &&
( isEditMode || isZoomOutMode ) &&
! hasFixedToolbar &&
( ! isDistractionFree || isNavigationMode() ) &&
isLargeViewport &&
Expand Down

0 comments on commit 0bc014c

Please sign in to comment.