WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.57k stars 4.22k forks source link

Make BlockManager filterable #15265

Open swissspidy opened 5 years ago

swissspidy commented 5 years ago

Is your feature request related to a problem? Please describe.

In our project we have some blocks that are absolutely crucial to editing a specific custom post type.

The BlockManager allows disabling all blocks, including the crucial ones. Doing so would lead to unexpected behavior.

Describe the solution you'd like

There should be a way to prevent individual block types from being disabled in the block manager.

In addition to that, or as an alternative, there could be a way to completely disable the block manager.

If you have a custom post type with only two registered custom block types that are crucial to editing the post, it makes no sense to offer the block manager at all.

Describe alternatives you've considered

Hiding the block manager or individual blocks in the block manager via CSS is the only possible alternative I see at the moment. Which is not a good alternative IMO.

gziolo commented 5 years ago

Are there more issues like that? If we were to offer this kind of functionality, we should come up with a general-purpose solution that would allow us to filter out all menu items and groups.

edisonake commented 5 years ago

I have been trying to figure out a solution for this same issue and was using the CSS approach to hide the block manager. Additionally though, I need to hide it based on user role for my project, so I think a general-purpose solution like you mentioned would be really great if menu items and groups could be hidden based on user role or post type.

skorasaurus commented 3 years ago

now in the https://github.com/WordPress/gutenberg/blob/trunk/packages/edit-post/src/components/block-manager/index.js block-manager component