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

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

noisysocks opened this issue Apr 9, 2018 · 4 comments

Comments

@noisysocks
Copy link
Member

@noisysocks 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 this to the Merge Proposal milestone Apr 9, 2018
@paulwilde
Copy link
Contributor

@paulwilde paulwilde commented Apr 9, 2018

#5893 is also related. Probably a dupe actually.

@noisysocks
Copy link
Member Author

@noisysocks noisysocks commented Apr 10, 2018

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.

@jasonbahl
Copy link

@jasonbahl jasonbahl commented Apr 27, 2018

#6363 seems related.

@noisysocks
Copy link
Member Author

@noisysocks noisysocks commented Jun 6, 2018

#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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.