-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
List Block: Try nesting with InnerBlocks #6394
Comments
Actually, the current List block surprisingly already allows for nested lists of different types. But yeah, using the nested block system for List blocks would be neat. Here is what I think it would probably look like in the |
I just realized that my markup did not make any sense because it did not have any markup for the proposed List Item block, so I fixed that: https://pastebin.com/pQs3Gnp1 It then occurred to me that if the List block started using nesting, then you could theoretically allow almost any block in a List Item block, allowing for lists of images, quotes, Custom HTML blocks containing description lists ( |
+1 I'd find it very useful to be able to re-order list items without copy/paste. Currently, the copy-paste approach doesn't preserve nesting. So if I copy a list item that has children to a new location in the list, the children get all squashed up together into the parent item. |
Would be a list a good way to model the following content/design/structure? (List-like icon) Heading (List-like icon) Heading (List-like icon) Heading (and so on) This isn't possible with current list block because at least a line Each title + description text could be wrapped into a container block or separate paragraph with styles, |
@strarsis what you're describing sounds like a description list. Discussion is on #4880 and there's also a plugin you can use today here (with all the UI/UX issues that come with nested blocks): https://github.com/lassemt/wp-block-description-list |
@hacknug: This is exactly what I had been looking for! I had to use sections, titles and paragraphs for |
@strarsis that's the beauty of semantic html haha |
@hacknug: The only downside with |
@strarsis the first problem you mentioned could be solved using the adjacent selector ( |
@ZebulanStanphill how is this accomplished? I've been trying to nest OLs and ULs and have not been able to do so. |
@eshannon3 Indent a list item, and while your text cursor is on that item, use the toolbar to toggle the list type. |
@ZebulanStanphill OH! Thank you so much! I kept selecting multiple items to toggle, which toggled all levels. |
I believe that this would resolve #21406 if we get it in. |
I'm very interested in making this happen, or at least figuring out if we can make it happen. I tried an approach with a Some initial impressions:
|
This will be a very interesting challenge, but one I'm not super eager to take on. I'd be more than happy to review work on it though. Yes, rich text currently handles all of it. Hopefully one day we can reduce complexity in rich text by removing multi line values. |
Hey, thank you all so much for working on this! We're working on a block-based blog for a client and they reached out with a request related to nesting blocks within list items. I had a couple questions about this effort:
We'd love to support this request from our client, but we're hesitant to create our own list block to do so, especially if your team is working on a similar solution. I wasn't sure who would know the answers to these questions. @youknowriad , @ellatrix would either of you know or know who I should ask? We're loving the block editor. Thanks for all the great work! |
@Paul-Hebert Hi there and thanks for your interest here. It's going to be very hard for me to give you precise answers thought, the reason is that there's still some unknowns for us. Basically, we're working on that block indeed, we don't really know if we will allow other blocks as list items, but the main question for us right now is whether we will be able to provide a UX that is on par with the current block. One of the main challenges being the keyboard interactions. I suggest you subscribe to this thread and the related PRs and follow the progress. |
@youknowriad , thanks for taking the time to respond! That makes sense. I know it can be hard to give precise answers while still answering unknowns. I can also understand how keyboard interactions could get tricky for that block. I'll circle back with our client and see how they'd like to proceed here. I'll also subscribe to this thread. Are there any open PRs I should track as well? Thanks |
You might want to check the List block label as this is being worked on on multiple small PRs. |
Thanks @youknowriad ! |
Issue Overview
Why use nesting for the list block?
RichText
component. Currently themultiline
option is only used by lists (and not really intended for it). We could make it as simple as inline only where it would be one string of phrasing content. This would further reduce the scope ofcontenteditable
use in the editor, hopefully resulting in a more predictable list block.How?
As far as I can see, there are two options:
The latter method is how it is done in e.g. Google Docs and MS Word, but they don't have to care about the HTML output that much (except for export). Google Docs doesn't even care about the previous item when it comes to indentation.
What would be the best approach to do this?
The text was updated successfully, but these errors were encountered: