wrapInList does not work with itemContent set to paragraph (ordered_list | bullet_list)*

If I add list nodes with addListNodes(nodes, "paragraph (ordered_list | bullet_list)*", "block"), wrapInList does not work when I select two or more paragraphs to wrap them into a list (with two or more resulting items) - it returns false from findWrappingInside.

However, if I use a content spec of "paragraph block*", wrapInList seems to work flawlessly with multiple paragraphs.

Is this expected? Am I doing something silly?

wrapInList seems to proceed by first wrapping the entire selection in a single list item and then splitting it as possible. In your case, since two paragraphs aren’t valid content for a list item, that’s impossible, causing the command to fail. It might be worthwhile to rewrite the command to be able to deal with this, but I’m unlikely to have time for that in the near future, so you’d have to create a pull request yourself.

1 Like