You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow InnerBlocks Component's allowedBlocks prop to pass options to child blocks #63997
InnerBlocks Component gives us a lot of power and the existing options for templates and locking for instance are great. However I recently ran into a use case where I have a parent block using an InnerBlocks component and wanted to use the core/paragraph block as a child block. However the block's default allowedFormats from the Formats API allows for things like Inline Images that due to design limitations of this particular block don't make sense to allow due to space.
I could create my own custom Paragraph block but that doesn't seem great when the core Paragraph block is perfect if I could disable certain formats. I can do that via a filter on the block but if I want to allow Inline Images elsewhere then it gets more complicated and I suppose I'd have to have my filter of the core/paragraph block try to determine if this instance of the block is a child of my custom parent block.
What is your proposed solution?
Could we make it easier to modify allowedFormats option of RichText in nested child blocks for instance?
Could the allowedBlocks prop on InnerBlocks be expanded to allow for more than just an array of strings with the block names? Could you pass an object instead that specifies the allowed block and some options to be passed to the block in just that instance when it is nested in that InnerBlocks context?
I believe this issue is more about controlling block formats and allowing customizing allowedFormats for block types. If the allowedFormats format could be modified using block attributes, you could easily configure it for inner blocks.
There's already a similar proposal - #43084. I'm going to close this as a duplicate. Please subscribe to that issue for future updates.
Activity
Mamaduka commentedon Mar 28, 2025
Thanks for contributing, @acketon!
I believe this issue is more about controlling block formats and allowing customizing
allowedFormatsfor block types. If theallowedFormatsformat could be modified using block attributes, you could easily configure it for inner blocks.There's already a similar proposal - #43084. I'm going to close this as a duplicate. Please subscribe to that issue for future updates.