Single level lists

I’m trying to achieve single level lists, as they are known from, for example, the macOS notes app. I’m using this approach:

nodes: addListNodes(schema.spec.nodes, "paragraph", "block"),

As you can see i’m using "paragraph" instead of "paragraph block+". However, with this configuration, the joinBackward command doesn’t work. This can be seen when doing Backspace when the caret is placed at the beginning of a list item: instead of joining the item with previous, it selects previous.

The Backspace key is configured here. Internally, codeflow will end up here and return false, because canJoin() returns false: the default implementation is trying to join the paragraph of one item into the surrounding block of the previous item, which, according to my schema definition, is not allowed.

So what should happen is, that it directly joins the two paragraphs together, creating a single paragraph - however, it looks like the default implementation doesn’t handle that right now.

I need some advice on how to achieve this. My assumption is that the canJoin call here needs to return true and then here the join should be followed by another join. Is this correct?

I think the best way to approach this is to add your own command (bound to backspace) that detects this situation and joins both the list items and their paragraphs (by deleting the </p></li><li><p> tokens between them) when it applies.

Did you manage to solve this? I am also looking for a single list solution. Are you willing to share the solution?

No, i haven’t gotten to it yet!