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

Closed
noisysocks opened this issue Apr 9, 2018 · 4 comments
Closed
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Bug An existing feature does not function as intended
Milestone

Comments

@noisysocks
Copy link
Member

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 does not function as intended [Feature] Inserter The main way to insert blocks using the + button in the editing interface labels Apr 9, 2018
@noisysocks noisysocks added this to the Merge Proposal milestone Apr 9, 2018
@paulwilde
Copy link
Contributor

paulwilde commented Apr 9, 2018

#5893 is also related. Probably a dupe actually.

@gziolo gziolo added the [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) label Apr 9, 2018
@noisysocks
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.

@noisysocks noisysocks removed the [Feature] Synced Patterns Related to synced patterns (formerly reusable blocks) label Apr 10, 2018
@jasonbahl
Copy link

#6363 seems related.

@noisysocks
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
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants