Skip to content

Commit

Permalink
Zoom back out when exiting editor
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Oct 18, 2024
1 parent c7a0316 commit c13dad0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
import { store as preferencesStore } from '@wordpress/preferences';
import { decodeEntities } from '@wordpress/html-entities';
import { Icon, arrowUpLeft } from '@wordpress/icons';
import { store as blockEditorStore } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -153,6 +154,9 @@ export default function EditSiteEditor( { isPostsList = false } ) {
[ settings.styles, canvasMode, currentPostIsTrashed ]
);
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
const { __unstableSetEditorMode, resetZoomLevel } = unlock(
useDispatch( blockEditorStore )
);
const { createSuccessNotice } = useDispatch( noticesStore );
const history = useHistory();
const onActionPerformed = useCallback(
Expand Down Expand Up @@ -261,6 +265,11 @@ export default function EditSiteEditor( { isPostsList = false } ) {
tooltipPosition="middle right"
onClick={ () => {
setCanvasMode( 'view' );
__unstableSetEditorMode(
'edit'
);
resetZoomLevel();

// TODO: this is a temporary solution to navigate to the posts list if we are
// come here through `posts list` and are in focus mode editing a template, template part etc..
if (
Expand Down

0 comments on commit c13dad0

Please sign in to comment.