ProseMirror / prosemirror

The ProseMirror WYSIWYM editor

Home Page:http://prosemirror.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

After deletion of expanded selection in list, list items remain and cannot be removed

Nantris opened this issue · comments

It's possible to reproduce this issue with the example editor, starting with an initial state like this:

image

ProseMirror-list-deletion-issue.mp4

What would you expect the editor to do in this case? The list item still has another child, so it can't be deleted. The paragraph also can't be removed, since it would violate the schema constraints on what a list item can hold.

Thanks for your reply @marijnh. The most common behavior I've seen for editors in these cases is to lift the lists beneath the deleted list items up to the top level, or to the level where the selection started if it's not the top of the list.

But I guess that can't be achieved via a single transaction on a single node which may be against the ProseMirror way of doing things?

I noticed a number of odd behaviors and I wonder which of them are intentional design choices and which of them are bugs.

The command that runs here (joinBackwards) knows nothing about lists or specific schemas and acts on arbitrary node structures in arbitrary schemas. As such, there's no hard-coded list logic in it and performing the behavior you are expecting (which doesn't sound all that obvious) is beyond it.