Skip to content

Commit

Permalink
Try zooming out when selecting the patterns tab in the inserter (Word…
Browse files Browse the repository at this point in the history
…Press#65785)

* adds handler for inserter tabs that engages zoom out view and mode

* Only moving to blocks should reset zoom out mode

* use hook to handle zoom out view, the hook respects the current zoom out setting

---------

Co-authored-by: draganescu <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: jeryj <[email protected]>
Co-authored-by: richtabor <[email protected]>
  • Loading branch information
5 people authored and karthick-murugan committed Nov 13, 2024
1 parent e5bbd7b commit c5cd4da
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import InserterSearchResults from './search-results';
import useInsertionPoint from './hooks/use-insertion-point';
import { store as blockEditorStore } from '../../store';
import TabbedSidebar from '../tabbed-sidebar';
import { useZoomOut } from '../../hooks/use-zoom-out';

const NOOP = () => {};
function InserterMenu(
Expand Down Expand Up @@ -77,6 +78,10 @@ function InserterMenu(
}
const [ selectedTab, setSelectedTab ] = useState( getInitialTab() );

const shouldUseZoomOut =
selectedTab === 'patterns' || selectedTab === 'media';
useZoomOut( shouldUseZoomOut );

const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] =
useInsertionPoint( {
rootClientId,
Expand Down

0 comments on commit c5cd4da

Please sign in to comment.