Skip to content

Commit

Permalink
Block Editor: Allow other blocks to use the slash inserter (#35196)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Sep 30, 2021
1 parent dbeebb9 commit d78bbc8
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/autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
__unstableUseAutocompleteProps as useAutocompleteProps,
} from '@wordpress/components';
import { useMemo } from '@wordpress/element';
import { getDefaultBlockName } from '@wordpress/blocks';
import { getDefaultBlockName, getBlockSupport } from '@wordpress/blocks';

/**
* Internal dependencies
Expand All @@ -33,7 +33,10 @@ function useCompleters( { completers = EMPTY_ARRAY } ) {
return useMemo( () => {
let filteredCompleters = completers;

if ( name === getDefaultBlockName() ) {
if (
name === getDefaultBlockName() ||
getBlockSupport( name, '__experimentalSlashInserter', false )
) {
filteredCompleters = filteredCompleters.concat( [
blockAutocompleter,
] );
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/navigation-link/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
],
"supports": {
"reusable": false,
"html": false
"html": false,
"__experimentalSlashInserter": true
},
"editorStyle": "wp-block-navigation-link-editor",
"style": "wp-block-navigation-link"
Expand Down

0 comments on commit d78bbc8

Please sign in to comment.