Skip to content

Commit

Permalink
Use setInserterInsertionPoint in quick inserter
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Sep 9, 2024
1 parent fb92845 commit 392038a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useInsertionPoint from './hooks/use-insertion-point';
import usePatternsState from './hooks/use-patterns-state';
import useBlockTypesState from './hooks/use-block-types-state';
import { store as blockEditorStore } from '../../store';
import { unlock } from '../../lock-unlock';

const SEARCH_THRESHOLD = 6;
const SHOWN_BLOCK_TYPES = 6;
Expand Down Expand Up @@ -82,17 +83,18 @@ export default function QuickInserter( {
}
}, [ setInserterIsOpened ] );

const { showInsertionPoint } = useDispatch( blockEditorStore );
const { showInsertionPoint, setInserterInsertionPoint } = unlock(
useDispatch( blockEditorStore )
);

// When clicking Browse All select the appropriate block so as
// the insertion point can work as expected.
const onBrowseAll = () => {
setInserterIsOpened( {
rootClientId,
insertionIndex,
filterValue,
onSelect,
} );
setInserterInsertionPoint( { rootClientId, insertionIndex } );
showInsertionPoint( rootClientId, insertionIndex );
};

Expand Down

0 comments on commit 392038a

Please sign in to comment.