Lifting and Parent Nodes


#1

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.


#2

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


#3

Cool, thanks.