Skip to content
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

InnerBlocks / Inserter: Auto-Add new block on click when allowedBlocks only contains 1 block #18017

Closed
rhurling opened this issue Oct 18, 2019 · 2 comments
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed

Comments

@rhurling
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to build multiple blocks where there is only 1 specific block allowed in the InnerBlocks component, which is the specific sub-block i build for the main block (Slider -> Slider Item; Accordion -> Accordion Item, ...). The frustrating thing is that I can't find a way to make the Inserter autoselect the only block available.

Describe the solution you'd like
I'd like the InnerBlocks.ButtonBlockAppender to automatically add the block if only 1 is available.

Describe alternatives you've considered
Otherwise some form of documentation for an example renderAppender function that actually adds a block. I've been trying to look through the InnerBlocks.ButtonBlockAppender but I can't seem to find where the actual adding of the block is handled.

@swissspidy swissspidy added [Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Oct 18, 2019
@swissspidy
Copy link
Member

This seems like a duplicate of #16659 which has a PR at #16708. Can you confirm that?

@rhurling
Copy link
Author

Yes, it seems that PR would enable the same behavior.
Couldn't find the other issue and / or the PR, but I was searching for InnerBlocks so that might explain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed
Projects
None yet
Development

No branches or pull requests

2 participants