You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever new RemoveOperation is created, $graveyard root is checked for how many $graveyardHolder nodes it has and the target of RemoveOperation is set to the new $graveyardHolder that will be inserted during operation execution at the end of $graveyard.
Simple example of situation when editor throws. Consider a batch that removes a character and removes bold from it afterwards. It's based on real scenario where post fixer callback fixes model and adds it's changes to the same batch (original issue: https://github.com/ckeditor/ckeditor5-list/issues/51):
REMOVE from $root [ 0, 1 ], 1 node, to $graveyard [ 0, 0 ].
SET ATTRIBUTE "bold"=true on $graveyard [ 0, 0 ] - [ 0, 1 ].
REINSERT from $graveyard [ 0, 0 ], 1 node, to $root [ 0, 1 ].
Now redo:
REMOVE from $root [ 0, 1 ], 1 node, to $graveyard [ 1, 0 ] (new remove operation, creates new graveyard holder).
REMOVE ATTRIBUTE "bold" from $graveyard [ 0, 0 ] - [ 0, 1 ]. <-- this throws, as there are no nodes in [ 0, 0 ].
It makes sense that RemoveOperation created from ReinsertOperation reversing should put nodes back in their original place. The only scenario where ReinsertOperation is reversed is redo.
The text was updated successfully, but these errors were encountered:
Whenever new
RemoveOperation
is created,$graveyard
root is checked for how many$graveyardHolder
nodes it has and the target ofRemoveOperation
is set to the new$graveyardHolder
that will be inserted during operation execution at the end of$graveyard
.Simple example of situation when editor throws. Consider a batch that removes a character and removes bold from it afterwards. It's based on real scenario where post fixer callback fixes model and adds it's changes to the same batch (original issue: https://github.com/ckeditor/ckeditor5-list/issues/51):
REMOVE
from$root [ 0, 1 ]
,1
node, to$graveyard [ 0, 0 ]
.REMOVE ATTRIBUTE "bold"
from$graveyard [ 0, 0 ] - [ 0, 1 ]
.When it is undone, following batch is generated:
SET ATTRIBUTE "bold"=true
on$graveyard [ 0, 0 ] - [ 0, 1 ]
.REINSERT
from$graveyard [ 0, 0 ]
,1
node, to$root [ 0, 1 ]
.Now redo:
REMOVE
from$root [ 0, 1 ]
,1
node, to$graveyard [ 1, 0 ]
(new remove operation, creates new graveyard holder).REMOVE ATTRIBUTE "bold"
from$graveyard [ 0, 0 ] - [ 0, 1 ]
. <-- this throws, as there are no nodes in[ 0, 0 ]
.It makes sense that
RemoveOperation
created fromReinsertOperation
reversing should put nodes back in their original place. The only scenario whereReinsertOperation
is reversed is redo.The text was updated successfully, but these errors were encountered: