-
Notifications
You must be signed in to change notification settings - Fork 180
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
5.9 beta - FR - Allow support for AllowedBlocks #299
Comments
Hi @JiveDig I've got good news to report on this topic 🙌. The To pass an array via HTML attribute, please use a combination of
👨💻 For more info on the InnerBlocks component: https://github.com/WordPress/gutenberg/tree/master/packages/block-editor/src/components/inner-blocks |
And here's a working example of the "template" and "templateLock" attributes:
👨💻 The templateLock attribute may not be working 100% as expected and more testing will need to be done with this WP component. |
@elliotcondon Thanks for your work. Is there also a way to remove specific types of blocks from the inserter? |
@CreativeDive I don't believe the InnerBlocks component provides a "denyBlocks" property, but this would be a great idea to pass onto the WP devs! |
This is working really well for me. Thanks so much for the example code. I'm going to close this. |
Just a note with the above example, I was having an issue where the block would be rendered fine in the editor but not the front-end. Changing
To
(capital I on InnerBlocks) sorted it. |
@cmbibby Yes. The uppercase is very import here to distinguish the element as a JSX component. |
I say keep it one way, so code examples moving forward are consistent. Easy to debug if someone does case wrong. |
Yeah I think keep the JSX elements pascal case to avoid confusion. Will be easier to distinguish between html and jsx that way too. |
Thanks guys 👍. I agree with this direction. PascalCase it is. |
TY so much for considering InnerBlock support Elliot! Initial testing now and first impressions are great.
Feature Request: It would be great to limit nested blocks to specific other blocks - thinking columns wrap with a column block here, but many use-cases will present themselves.
https://developer.wordpress.org/block-editor/tutorials/block-tutorial/nested-blocks-inner-blocks/#allowed-blocks
When i try versions of this
<InnerBlocks allowedBlocks={ 'core/image' } />
in my callback/template I get this error:The text was updated successfully, but these errors were encountered: