diff --git a/packages/block-editor/src/components/inserter/menu.js b/packages/block-editor/src/components/inserter/menu.js index 6a38e52cbffba1..8e93ed59836ee1 100644 --- a/packages/block-editor/src/components/inserter/menu.js +++ b/packages/block-editor/src/components/inserter/menu.js @@ -45,6 +45,7 @@ function InserterMenu( showMostUsedBlocks, __experimentalFilterValue = '', shouldFocusBlock = true, + __experimentalInitialCategory, }, ref ) { @@ -56,8 +57,9 @@ function InserterMenu( const [ patternFilter, setPatternFilter ] = useState( 'all' ); const [ selectedMediaCategory, setSelectedMediaCategory ] = useState( null ); - const [ selectedTab, setSelectedTab ] = useState( null ); - + const [ selectedTab, setSelectedTab ] = useState( + __experimentalInitialCategory || null + ); const [ destinationRootClientId, onInsertBlocks, onToggleInsertionPoint ] = useInsertionPoint( { rootClientId, @@ -259,6 +261,7 @@ function InserterMenu( showMedia={ showMedia } onSelect={ handleSetSelectedTab } tabsContents={ inserterTabsContents } + initialTabId={ __experimentalInitialCategory } /> ) } { ! delayedFilterValue && ! showAsTabs && ( diff --git a/packages/block-editor/src/components/inserter/tabs.js b/packages/block-editor/src/components/inserter/tabs.js index 4795c3ce4fdc24..af86d7dc69a8db 100644 --- a/packages/block-editor/src/components/inserter/tabs.js +++ b/packages/block-editor/src/components/inserter/tabs.js @@ -33,6 +33,7 @@ function InserterTabs( { showMedia = false, onSelect, tabsContents, + initialTabId, } ) { const tabs = [ blocksTab, @@ -42,7 +43,7 @@ function InserterTabs( { return (
- + { tabs.map( ( tab ) => (