Skip to content

Nested Blocks: Inner block arrangement options #5448

Closed

Description

Previously: #2995 (#2995 (comment)), #3745 (#3745 (comment))

The InnerBlocks component, used for block nesting, should allow a block implementer to assign a predefined block arrangement, optionally locking or otherwise restricting the types of blocks which are available for insertion in the block.

This could potentially align with existing block templating

Pseudo-code examples:

<InnerBlocks
	allowedBlockNames={ [ 'core/image', 'core/paragraph' ] }
	template={ [
		createBlock( 'core/image' ),
		createBlock( 'core/paragraph' ),
	] }
/>

For the inverse relationship (blocks restricted to certain parent contexts), we could either...

  • Rely on a combination of block's isPrivate API (already used to omit block from inserter) and treat allowedBlockNames as overriding this preference
  • Add a property to the block API, allowedRootBlockNames: [ ... ]

Related Work:

Discussion by @jorgefilipecosta about defining inner blocks supported:

https://wordpress.slack.com/archives/C02QB2JS7/p1520252046000229

cc @jorgefilipecosta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions