Skip to content

Commit c85370d

Browse files
authored
Zoom Out: When double clicking a template while zoomed out , reset zoom 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
1 parent b06549d commit c85370d

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

packages/block-editor/src/private-apis.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { usesContextKey } from './components/rich-text/format-edit';
3232
import { ExperimentalBlockCanvas } from './components/block-canvas';
3333
import { getDuotoneFilter } from './components/duotone/utils';
3434
import { useFlashEditableBlocks } from './components/use-flash-editable-blocks';
35+
import { useZoomOutModeExit } from './components/block-list/use-block-props/use-zoom-out-mode-exit';
3536
import {
3637
selectBlockPatternsKey,
3738
reusableBlocksSelectKey,
@@ -78,6 +79,7 @@ lock( privateApis, {
7879
TextAlignmentControl,
7980
usesContextKey,
8081
useFlashEditableBlocks,
82+
useZoomOutModeExit,
8183
globalStylesDataKey,
8284
globalStylesLinksDataKey,
8385
selectBlockPatternsKey,

packages/editor/src/components/visual-editor/edit-template-blocks-notification.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
6161
) {
6262
return;
6363
}
64-
setIsDialogOpen( true );
64+
65+
if ( ! event.defaultPrevented ) {
66+
event.preventDefault();
67+
setIsDialogOpen( true );
68+
}
6569
};
6670

6771
const canvas = contentRef.current;

packages/editor/src/components/visual-editor/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const {
4848
useLayoutStyles,
4949
ExperimentalBlockCanvas: BlockCanvas,
5050
useFlashEditableBlocks,
51+
useZoomOutModeExit,
5152
} = unlock( blockEditorPrivateApis );
5253

5354
/**
@@ -335,6 +336,7 @@ function VisualEditor( {
335336
useSelectNearestEditableBlock( {
336337
isEnabled: renderingMode === 'template-locked',
337338
} ),
339+
useZoomOutModeExit(),
338340
] );
339341

340342
const zoomOutProps =

0 commit comments

Comments
 (0)