Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@ function InserterMenuDownloadableBlocksPanel() {

return (
<__experimentalInserterMenuExtension>
{ ( { onSelect, onHover, filterValue, hasItems } ) => {
if ( hasItems || ! filterValue ) {
{ ( {
onSelect,
onHover,
filterValue,
hasItems,
hasChildItems,
hasAllowedBlocks,
} ) => {
if (
hasItems ||
hasChildItems ||
hasAllowedBlocks ||
! filterValue
) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ export function BlockTypesTab( {
[ rootClientId ]
);

const hasAllowedBlocks = useSelect( ( select ) => {
const { __experimentalGetAllowedBlocks } = select(
'core/block-editor'
);
return __experimentalGetAllowedBlocks( rootClientId ) !== undefined;
} );

const filteredItems = useMemo( () => {
return searchBlockItems( items, categories, collections, filterValue );
}, [ filterValue, items, categories, collections ] );
Expand Down Expand Up @@ -216,6 +223,8 @@ export function BlockTypesTab( {
onHover,
filterValue,
hasItems,
hasChildItems,
hasAllowedBlocks,
} }
>
{ ( fills ) => {
Expand Down