Lifting and Parent Nodes

Am I correct to think that when you lift all the child nodes out of a parent node, that the parent node is automatically removed and you don’t have to worry about violating the parent node’s content expression?

Take this trivial example:

listitem

let range = $from.blockRange($to);
tr.lift(range, 0);

When I lift this single list item node out of the bullet list, the bullet list is automatically removed. Which is good, because if it wasn’t removed the bullet_list would be violating its schema since it would lack any child nodes.

Is my understanding correct or am I missing something? Thanks in advance.

Yes, that’s correct—Transform.lift has logic to completely remove the parent node when you lift the last child.

Cool, thanks.

Looks like there is no way to disable this behavior, right? Trying to make sense of the Transform.Lift function to understand how it does this–so I could write my own implementation without it. Any hints you wouldn’t mind giving? @marjin