Skip to content

Commit

Permalink
Hacking to get patterns tab open. Need to head check this
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Jan 9, 2024
1 parent 10ceab7 commit 04a9f97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/block-editor/src/components/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function InserterMenu(
showMostUsedBlocks,
__experimentalFilterValue = '',
shouldFocusBlock = true,
__experimentalInitialCategory,
},
ref
) {
Expand All @@ -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,
Expand Down Expand Up @@ -259,6 +261,7 @@ function InserterMenu(
showMedia={ showMedia }
onSelect={ handleSetSelectedTab }
tabsContents={ inserterTabsContents }
initialTabId={ __experimentalInitialCategory }
/>
) }
{ ! delayedFilterValue && ! showAsTabs && (
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/src/components/inserter/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function InserterTabs( {
showMedia = false,
onSelect,
tabsContents,
initialTabId,
} ) {
const tabs = [
blocksTab,
Expand All @@ -42,7 +43,7 @@ function InserterTabs( {

return (
<div className="block-editor-inserter__tabs">
<Tabs onSelect={ onSelect }>
<Tabs initialTabId={ initialTabId } onSelect={ onSelect }>
<Tabs.TabList>
{ tabs.map( ( tab ) => (
<Tabs.Tab key={ tab.name } tabId={ tab.name }>
Expand Down

0 comments on commit 04a9f97

Please sign in to comment.