From b2a0853fa6344c39954711b537a31c594f143157 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 20 Mar 2024 09:43:21 +0400 Subject: [PATCH] Pattern Explorer: Pass 'rootClientId' to the pattern list (#60014) Co-authored-by: Mamaduka Co-authored-by: t-hamano Co-authored-by: dsas --- .../components/inserter/block-patterns-explorer/index.js | 1 + .../inserter/block-patterns-explorer/pattern-list.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js b/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js index 82e8a4435b0324..bd4bccffd4e81b 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js +++ b/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js @@ -41,6 +41,7 @@ function PatternsExplorer( { initialCategory, rootClientId } ) { selectedCategory={ selectedCategory } patternCategories={ patternCategories } patternSourceFilter={ patternSourceFilter } + rootClientId={ rootClientId } /> ); diff --git a/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js b/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js index 217f3f21b573df..a5e43c2c6bf870 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js +++ b/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js @@ -47,10 +47,16 @@ function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) { ); } -function PatternList( { searchValue, selectedCategory, patternCategories } ) { +function PatternList( { + searchValue, + selectedCategory, + patternCategories, + rootClientId, +} ) { const container = useRef(); const debouncedSpeak = useDebounce( speak, 500 ); const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( { + rootClientId, shouldFocusBlock: true, } ); const [ patterns, , onClickPattern ] = usePatternsState(