ListItem node lost when pasting if the pasted listitem content is a defining node

In my schema the main/first content of a listitem may be a paragraph or heading (or some other simple textblock). Heading in the default and in my schema is marked as defining. I’m finding that when pasting <ul> <li><h1/></li> <li><h1/></li> </ul> that the first list item is lost.

I created a glitch to demonstrate. The steps are to select and copy the entire list in the div at the bottom. Then put focus into the prosemirror editor at the top and paste. The result looks like this: image

If heading were not marked as defining this doesn’t happen but I think I want heading to remain defining.I’m not sure why the defining of the content of the paste is playing a role here. I see that during the paste the slice of such has an open start/end of 3 so the starting and ending ul/li/h1 are considered open. I thought defining was more about the target of the paste though honestly if the current target is h1 (i.e. in the sample you changed the type in the editor to heading->level1 before pasting) that I’d still want to keep the list and both list items.

Is a bug and I should just submit it as such? If not, can you suggest any workaround? Guess I’ll need to intercept the paste, inspect the selection pos and the slice and possibly use an adjusted slice that isn’t completely open on the ends but I haven’t tried that yet.

Yeah, I guess replaceRange could behave better here. This patch should help.

Awesome! Thank you very much. That fixes the issue