Implement the nested block behavior in list block v2#39487
Conversation
|
Size Change: +224 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Could we add some checks to return null if there are no inner blocks? It is very easy to create an empty list item for the user is very hard to remove. Or maybe we can automatically remove the list block if it becomes empty?
There was a problem hiding this comment.
we should add a shortcut later that removes it on backspace
ntsekouras
left a comment
There was a problem hiding this comment.
For me this is a good base implementation to land and split the rest of the work in parallel. Thanks Riad!
There was a problem hiding this comment.
Nitpick: { allowedBlocks: [ 'core/list' ] } could be moved to a constant outside of the component to avoid recreating it on every render.
e5b0031 to
74e079f
Compare
mcsf
left a comment
There was a problem hiding this comment.
Nothing to add here, just glad to see the experiment taking off!
| "content": { | ||
| "type": "string", | ||
| "source": "html", | ||
| "selector": "li", |
Related #6394
What?
This PR implements the logic for the list block v2 (with inner blocks). It adds the base save/edit for list and list item blocks.
How?
At the moment, the block is very rough, I decided explicitly to only focus on:
There's a lot of things to be implemented here to make this block more usable, the idea is that now that we have the list block and basic behavior in place, we can potentially work in parallel if needed on some of these points:
Testing Instructions
1- Enable the "list block v2" experiment
2- Insert a list block
3- You can use appenders and such (regular inner blocks UI) to insert list items and nested lists (interaction is very rough without keyboard support)
4- Make sure the produced markup is correct.
Screen.Recording.2022-03-16.at.9.25.50.AM.mov