Closed
Description
openedon Mar 6, 2018
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 treatallowedBlockNames
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment