Skip to content

Commit

Permalink
Exit zoon out when mode is changed (WordPress#65975)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored and karthick-murugan committed Nov 13, 2024
1 parent 85c767b commit 63b4279
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/block-editor/src/components/tool-selector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function ToolSelector( props, ref ) {
( select ) => select( blockEditorStore ).__unstableGetEditorMode(),
[]
);
const { __unstableSetEditorMode } = unlock(
const { resetZoomLevel, __unstableSetEditorMode } = unlock(
useDispatch( blockEditorStore )
);

Expand Down Expand Up @@ -67,7 +67,10 @@ function ToolSelector( props, ref ) {
value={
mode === 'navigation' ? 'navigation' : 'edit'
}
onSelect={ __unstableSetEditorMode }
onSelect={ ( newMode ) => {
resetZoomLevel();
__unstableSetEditorMode( newMode );
} }
choices={ [
{
value: 'navigation',
Expand Down

0 comments on commit 63b4279

Please sign in to comment.