Skip to content

Commit

Permalink
Zoom Out: When double clicking a template while zoomed out , reset zo…
Browse files Browse the repository at this point in the history
…om level instead of showing dialog (#65963)

* Zoom Out: When double clicking a template while zoomed out, reset zoom level instead of showing template editing dialog

* Try reusing useZoomOutModeExit hook
  • Loading branch information
andrewserong authored Oct 10, 2024
1 parent b06549d commit c85370d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { usesContextKey } from './components/rich-text/format-edit';
import { ExperimentalBlockCanvas } from './components/block-canvas';
import { getDuotoneFilter } from './components/duotone/utils';
import { useFlashEditableBlocks } from './components/use-flash-editable-blocks';
import { useZoomOutModeExit } from './components/block-list/use-block-props/use-zoom-out-mode-exit';
import {
selectBlockPatternsKey,
reusableBlocksSelectKey,
Expand Down Expand Up @@ -78,6 +79,7 @@ lock( privateApis, {
TextAlignmentControl,
usesContextKey,
useFlashEditableBlocks,
useZoomOutModeExit,
globalStylesDataKey,
globalStylesLinksDataKey,
selectBlockPatternsKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
) {
return;
}
setIsDialogOpen( true );

if ( ! event.defaultPrevented ) {
event.preventDefault();
setIsDialogOpen( true );
}
};

const canvas = contentRef.current;
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const {
useLayoutStyles,
ExperimentalBlockCanvas: BlockCanvas,
useFlashEditableBlocks,
useZoomOutModeExit,
} = unlock( blockEditorPrivateApis );

/**
Expand Down Expand Up @@ -335,6 +336,7 @@ function VisualEditor( {
useSelectNearestEditableBlock( {
isEnabled: renderingMode === 'template-locked',
} ),
useZoomOutModeExit(),
] );

const zoomOutProps =
Expand Down

1 comment on commit c85370d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in c85370d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11276679523
📝 Reported issues:

Please sign in to comment.