Skip to content

Commit

Permalink
Fix contextual items
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Sep 20, 2024
1 parent 3e10f0b commit 6a79fbf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function BlockTypesTab(
continue;
}

if ( rootClientId && item.rootClientId === rootClientId ) {
if ( rootClientId && item.isAllowedInCurrentRoot ) {
itemsForCurrentRoot.push( item );
} else {
itemsRemaining.push( item );
Expand Down
11 changes: 11 additions & 0 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,17 @@ export const getInserterItems = createRegistrySelector( ( select ) =>
rootClientId
)
);
} else {
blockTypeInserterItems = blockTypeInserterItems.map(
( blockType ) => ( {
...blockType,
isAllowedInCurrentRoot: canIncludeBlockTypeInInserter(
state,
blockType,
rootClientId
),
} )
);
}

const items = blockTypeInserterItems.reduce(
Expand Down

0 comments on commit 6a79fbf

Please sign in to comment.