close
Skip to content

Allow InnerBlocks Component's allowedBlocks prop to pass options to child blocks #63997

@acketon

Description

@acketon

What problem does this address?

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Package] Format library/packages/format-library[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions