We can't lift/sink the range because they're in different depths.
This will split a selection into a list of {$from, $to} that can be lifted/sunk, e.g. B1 and A2 (which includes it's children).
If $from.depth > $to.depth like this, nothing is split (unless splitChildren is true) since sinking A1 implies sinking all it's children. The selection returned is adjusted though so $pos.node() is of the wanted node type.
- A|1 - B|1 - A2
splitChildren should be true when lifting a list, if we want the above to lift B1 if the selection touches it.
The function returns a selection like object with just $from and $to. This is because we need something like a BlockSelection really (multiple node selection), but NodeSelection does not support this.
mapSelection can be used to map the returned selection. This is necessary if changing the chunks as you go through them.
When we have a selection like so:
We can't lift/sink the range because they're in different depths.
This will split a selection into a list of {$from, $to} that can be lifted/sunk, e.g. B1 and A2 (which includes it's children).
If $from.depth > $to.depth like this, nothing is split (unless splitChildren is true) since sinking A1 implies sinking all it's children. The selection returned is adjusted though so $pos.node() is of the wanted node type.
splitChildrenshould be true when lifting a list, if we want the above to lift B1 if the selection touches it.The function returns a selection like object with just $from and $to. This is because we need something like a BlockSelection really (multiple node selection), but NodeSelection does not support this.
mapSelection can be used to map the returned selection. This is necessary if changing the chunks as you go through them.