Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompleter (slash command) doesn't respect allowed_block_types #6070

noisysocks opened this issue Apr 9, 2018 · 4 comments
[Feature] Inserter [Type] Bug An existing feature is broken.


Copy link

noisysocks commented Apr 9, 2018

Issue Overview

The blocks autocompleter (what you get when you type a /) doesn't respect the allowed_block_types filter.

Steps to Reproduce (for bugs)

  1. Add the following to the top of lib/load.php:
add_filter( 'allowed_block_types', function() {
	return [ 'core/paragraph', 'core/image', 'core/quote' ];
} );
  1. Create a post
  2. Press /

Expected Behavior

Only the Paragraph, Image and Quote bugs should appear in the dropdown.

Shared blocks should be properly filtered when using allowed_block_types filter.

Current Behavior

All blocks should appear in the dropdown.

If you limit the blocks which can be shown using the allowed_block_types filter then shared blocks do not appear in the 'Shared' block inserter tab.

Possible Solution

The getInserterItems selector will correctly filter out non-allowed blocks if you pass the editor setting as its second argument.

Screenshots / Video

autocompleter bug

Related Issues and/or PRs

#4225 #3791 — both of these would also be fixed by the above suggested solution.

@noisysocks noisysocks added [Type] Bug An existing feature is broken. [Feature] Inserter labels Apr 9, 2018
@noisysocks noisysocks added this to the Merge Proposal milestone Apr 9, 2018
Copy link

paulwilde commented Apr 9, 2018

#5893 is also related. Probably a dupe actually.

Copy link
Member Author

I don't think it's a dupe. #5893 is referring to shared blocks not appearing in the inserter when allowed_block_types is set to false, whereas #6070 is referring to all blocks mistakenly appearing in the / command regardless of what allowed_block_types is set to.

Copy link

#6363 seems related.

Copy link
Member Author

#6067 fixed this.

screen shot 2018-06-06 at 16 02 02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
[Feature] Inserter [Type] Bug An existing feature is broken.
None yet

No branches or pull requests

4 participants