Description
If deleteContent()
is executed on a selection which is in the graveyard root it will fail. It's because startPos
is created as a static position but since it is in the graveyard, it should be updated:
const startPos = selRange.start;
// ...
writer.remove( selRange );
// ...
mergeBranches( writer, startPos, endPos ); // <-- Incorrect `startPos` is used.
There are two possible solutions for this:
- Make
startPos
aLivePosition
. - Cancel
deleteContent
ifselRange
is in the graveyard.
We chose the second option because it is less prone to an error and generates no operations.