From c71defeb33523388a3f24c32f4b2f85c2c0dc4d7 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Fri, 25 Oct 2024 10:37:12 +0100 Subject: [PATCH 1/2] Only reset zoom level --- .../use-init-edited-entity-from-url.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js index 9f507693c4cfd..35eeb5963fb54 100644 --- a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +++ b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js @@ -249,15 +249,19 @@ export default function useInitEditedEntityFromURL() { useResolveEditedEntityAndContext( params ); const { setEditedEntity } = useDispatch( editSiteStore ); - const { __unstableSetEditorMode, resetZoomLevel } = unlock( - useDispatch( blockEditorStore ) - ); + const { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) ); useEffect( () => { if ( isReady ) { - __unstableSetEditorMode( 'edit' ); resetZoomLevel(); setEditedEntity( postType, postId, context ); } - }, [ isReady, postType, postId, context, setEditedEntity ] ); + }, [ + isReady, + postType, + postId, + context, + setEditedEntity, + resetZoomLevel, + ] ); } From aa7bd326b97b259c94567ea8526020fd5a2da0ff Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Fri, 25 Oct 2024 10:39:06 +0100 Subject: [PATCH 2/2] Avoid set editor mode on sidebar toggle --- packages/edit-site/src/components/editor/index.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index 9058a16370799..c7481a1d12bd7 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -153,9 +153,7 @@ export default function EditSiteEditor( { isPostsList = false } ) { ], [ settings.styles, canvas, currentPostIsTrashed ] ); - const { __unstableSetEditorMode, resetZoomLevel } = unlock( - useDispatch( blockEditorStore ) - ); + const { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) ); const { createSuccessNotice } = useDispatch( noticesStore ); const history = useHistory(); const onActionPerformed = useCallback( @@ -263,9 +261,6 @@ export default function EditSiteEditor( { isPostsList = false } ) { showTooltip tooltipPosition="middle right" onClick={ () => { - __unstableSetEditorMode( - 'edit' - ); resetZoomLevel(); // TODO: this is a temporary solution to navigate to the posts list if we are