Nested "Defining" Nodes

Hi. We are implementing a ProseMirror text editor. We are running into a copy & paste issue which seems like it may be due to having nested nodes with the defining attribute set to true on the NodeSpec.

Both our list node and heading node have defining set to true.

Example: We have a list and the first item contains a heading node. We use the mouse to select & copy the first list item. Then we paste, but only the heading node is retained and not the list item node.

We were able to solve this issue when we removed the defining equals true on the heading node. My guess is that there may be an issue with having nested nodes that have defining set to true.

Any ideas on why this might be happening or suggestions on how to work around this?

Thanks!

I think your expectation for how copy works is just different from what ProseMirror implements. It doesn’t automatically pull parent nodes into the copied slice when the selection is inside of them, except for the first defining node wrapping the selection.