-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Cannot disallow block without disallowing block variations #51112
Comments
@CodeProKid I would maybe imagine this being possible by removing the The other thing is that there has been some work on adding block supports for variations, and I think that would solve this issue (as |
I'll cc @ntsekouras who might have some thoughts. |
Ah yeah, I played around with this too and saw the same result. I think having support for this approach makes the most sense to unblock this use case. Looking at the code, it seems like when we go to grab the block variations, we only get the ones with the |
Thanks for the issue @CodeProKid! I agree with @talldan that probably we need to make new checks about This is also related to this issue and the solution will probably fix both. This is something that might be more convoluted than it seems, because if we start supporting override of the |
I have a use case that is the inverse where we need the ability to disable block variations but allow access to the base block. |
Description
I have a use case where I want to disallow a block from being added to the editor, but not the variations of the block. The two approaches I tried to make this work were by removing the block from the
allowedBlocks
passed in to the editor instance, and by setting theinserter
support tofalse
on the block. Unfortunately it looks like when the inserter determines which blocks & variations are eligible for insertion it won't make that determination against each variation individually if the block type is not eligible for insertion.Step-by-step reproduction instructions
inserter
supports flag tofalse
on a component with block variationsScreenshots, screen recording, code snippet
No response
Environment info
@wordpress/block-editor
9.5.0@wordpress/editor
12.0.2@wordpress/components
19.0.1Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: