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

Cover Image, Paragraph and Quote still appear next to the inserter even if they have been removed from the inserter via the allowed_block_types filter #3990

Closed
2 tasks
greatislander opened this issue Dec 14, 2017 · 1 comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Extensibility The ability to extend blocks or the editing experience Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Bug An existing feature does not function as intended

Comments

@greatislander
Copy link
Contributor

greatislander commented Dec 14, 2017

Issue Overview

In testing the allowed_block_types filter, it appears that the Cover Image, Paragraph and Quote blocks still appear next to the inserter when they have been removed from the inserter's list of allowed block types.

Steps to Reproduce (for bugs)

  1. Add this filter in your theme's functions.php:
add_filter( 'allowed_block_types', function() {
  return [ 'core/verse' ];
} );
  1. Edit a post in Gutenberg.

[Safari/Chrome, macOS High Sierra, WordPress 4.9.1, Gutenberg 1.9.1]

Expected Behavior

The inserter should only show available block types next to it.

Current Behavior

The Cover Image, Paragraph and Quote blocks appear next to the inserter even if they have been removed as allowed block types. Note that when all block types are removed they still appear, even though the inserter itself is gone.

Possible Solution

If any one of the Cover Image, Paragraph or Quote blocks are removed from the inserter, the slots next to the inserter button should be filled with others (perhaps via the same mechanism that populates the Recent Blocks tab).

Screenshots / Video

With this filter in place:

add_filter( 'allowed_block_types', function() {
  return [ 'core/verse' ];
} );

screen shot 2017-12-13 at 11 39 51 pm

With this filter in place:

add_filter( 'allowed_block_types', `__return_false` );

screen shot 2017-12-13 at 11 41 17 pm
Note that the insert button is absent.

Related Issues and/or PRs

#3968
#3988

Todos

  • Tests
  • Documentation
@greatislander greatislander changed the title Cover Image, Paragraph and Quote still appear next to the insert button even if they have been removed via the allowed_block_types filter Cover Image, Paragraph and Quote still appear next to the inserter even if they have been removed from the inserter via the allowed_block_types filter Dec 14, 2017
@greatislander greatislander changed the title Cover Image, Paragraph and Quote still appear next to the inserter even if they have been removed from the inserter via the allowed_block_types filter Cover Image, Paragraph and Quote still appear next to the inserter even if they have been removed from the inserter via the allowed_block_types filter Dec 14, 2017
@youknowriad youknowriad added the Good First Issue An issue that's suitable for someone looking to contribute for the first time label Dec 14, 2017
@gziolo gziolo added [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Blocks Overall functionality of blocks labels Feb 1, 2018
@gziolo gziolo added the [Type] Bug An existing feature does not function as intended label Feb 5, 2018
@noisysocks
Copy link
Member

#4497 fixed this.

screen shot 2018-04-26 at 16 40 39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Extensibility The ability to extend blocks or the editing experience Good First Issue An issue that's suitable for someone looking to contribute for the first time [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants