Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

very elegant 🙇🏻

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
Loading