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 (WordPress#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 and karthick-murugan committed Nov 13, 2024
1 parent 79b0555 commit 418449e
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

0 comments on commit 418449e

Please sign in to comment.