Skip to content

Commit

Permalink
use block insertion point index
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Aug 9, 2024
1 parent 3e2dc33 commit e3933c8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/editor/src/components/inserter-sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ const { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );

export default function InserterSidebar() {
const {
blockInsertionPoint,
blockSectionRootClientId,
inserterSidebarToggleRef,
blockInsertionPoint,
insertionPoint,
showMostUsedBlocks,
sidebarIsOpened,
} = useSelect( ( select ) => {
const {
getInserterSidebarToggleRef,
getBlockInsertionPoint,
getInserterSidebarToggleRef,
getInsertionPoint,
isPublishSidebarOpened,
} = unlock( select( editorStore ) );
const { getBlockRootClientId, __unstableGetEditorMode, getSettings } =
Expand All @@ -47,8 +49,9 @@ export default function InserterSidebar() {
return getBlockRootClientId();
};
return {
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
blockInsertionPoint: getBlockInsertionPoint(),
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
insertionPoint: getInsertionPoint(),
showMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),
blockSectionRootClientId: getBlockSectionRootClientId(),
sidebarIsOpened: !! (
Expand Down Expand Up @@ -87,13 +90,11 @@ export default function InserterSidebar() {
rootClientId={
blockSectionRootClientId ?? blockInsertionPoint.rootClientId
}
__experimentalInsertionIndex={
blockInsertionPoint.insertionIndex
}
onSelect={ blockInsertionPoint.onSelect }
__experimentalInitialTab={ blockInsertionPoint.tab }
__experimentalInitialCategory={ blockInsertionPoint.category }
__experimentalFilterValue={ blockInsertionPoint.filterValue }
__experimentalInsertionIndex={ blockInsertionPoint.index }
onSelect={ insertionPoint.onSelect }
__experimentalInitialTab={ insertionPoint.tab }
__experimentalInitialCategory={ insertionPoint.category }
__experimentalFilterValue={ insertionPoint.filterValue }
onPatternCategorySelection={
sidebarIsOpened
? () => disableComplementaryArea( 'core' )
Expand Down

0 comments on commit e3933c8

Please sign in to comment.