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

Allow / Dissalow nested sub-blocks #24596

Closed
Bysander opened this issue Aug 17, 2020 · 3 comments
Closed

Allow / Dissalow nested sub-blocks #24596

Bysander opened this issue Aug 17, 2020 · 3 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P

Comments

@Bysander
Copy link

If I create a foo Block and want to use and allow core blocks in the editing experience - like core/columns - I feel there should be a way of allowing or disallowing certain nested blocks ie.

<fooBlock>
    <coreColumns>
        <coreColumn>
             <fooBlock> // <------ this shouldn't be allowed

Similarly -

<fooBlock>
    <coreColumns>
        <coreColumn>
             <barBlock> // <------ this should only be allowed to be inserted within a foo Block

If I allow barBlock to have a parent of core/column then barBlock can be inserted anywhere with a column.

If I only allow barBlock in a fooBlock then the editor cannot insert them into a column layout within fooBlock in the interface.

It would be nice to be able to allow this via accepted formats similar to the below for example

parent: [ 'foobars/foo > core/columns > core/column' ],

to show exact structure or perhaps

parent: [ 'foobars/foo.core/column' ],

To show any column within a foo block??

foobars/foo could then have an allowed_blocks parameter of core/columns or foobars/bar depending on how the editor wants the layout.

@youknowriad
Copy link
Contributor

Related #15682

@youknowriad youknowriad added the [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P label Aug 18, 2020
@Bysander
Copy link
Author

Bysander commented Aug 18, 2020

Another quick thought - could be to only allow blocks to sit within their own namespace...

foobars/foo could sit anywhere but it's child or sub block foobars/bar can only sit within another foobars/* element.

@jordesign
Copy link
Contributor

This appears to be resolved now (as best I can tell)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Nested / Inner Blocks Anything related to the experience of nested/inner blocks inside a larger container, like Group or P
Projects
None yet
Development

No branches or pull requests

4 participants