Closed Reinmar closed 1 year ago
Selection is restored incorrectly:
Rename leaks to a nearby element.
Additional list empty block appears (wrap, split):
Undo becomes noticeably slow when undoing typing :((((
It seems that typing compression will be a must-have in a short time.
Edit by LukaszGudel: It looks much better now, undoing and redoing typing is almost instant. IMO fixed.
basic-transformations.js:67 Uncaught TypeError: Cannot read property 'getNode' of undefined
at addTransformationCase (basic-transformations.js:67)
at Object.transform (transform.js:59)
at Object.transformDeltaSets (transform.js:268)
at Document.transformDeltas (document.js:359)
at RedoCommand._undo (basecommand.js:140)
at Array.editor.document.enqueueChanges (redocommand.js:42)
at Document.enqueueChanges (document.js:241)
at RedoCommand.execute (redocommand.js:36)
at RedoCommand.on (observablemixin.js:327)
at RedoCommand.fire (emittermixin.js:281)
Undo becomes noticeably slow when undoing typing :((((
Yes... This was another gain that we got by removing deltas from History
. There was much less transformations. I am sure we will spend time on this subject because it cannot work like this. I think there are places where optimisation could be applied, but this needs to be measured and researched.
Later, we can think about some tricks to maybe somehow skip some transformations or something but this has to be:
History
.position.js:158 Uncaught TypeError: this.parent.offsetToIndex is not a function
at Position.get index [as index] (position.js:158)
at Position.get textNode [as textNode] (position.js:169)
at Position.get nodeAfter [as nodeAfter] (position.js:181)
at _fixItemsIndent (converters.js:629)
at Document.<anonymous> (converters.js:576)
at Document.fire (emittermixin.js:281)
at Document.applyOperation (document.js:173)
at UndoCommand._undo (basecommand.js:153)
at Array.editor.document.enqueueChanges (undocommand.js:40)
at Document.enqueueChanges (document.js:241)
EDIT: This TC is really fragile. You need to be very precise regarding actions.
As for performance issues. I did a quick check.
Here's a general overview of a single undo step:
20 transformDeltas()
calls. Each 10ms. But the further you go back in the undo history, the longer the transformDeltas()
calls.
Now, it's very interesting to see what are the widest leafs of this flame chart:
Yep, Position()
constructors. If you'll scroll more you'll see that there also other constructors there (and they are similarly long), but the problem is that Position
repeats hundreds of times.
So, it's very likely that one of the most important issues https://github.com/ckeditor/ckeditor5-engine/issues/897.
Edit: I did a small check and removed cloning from Position.createFromPosition()
but it's too simplistic (because there are two position types). We'd need more time to check what we can gain by avoiding cloning all the time.
ckeditorerror.js:38 Uncaught CKEditorError: model-history-wrong-version: Given base version points to the middle of a delta.
at History._getIndex (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:41285:10)
at History.getDeltas (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:41187:24)
at getDeltas.next (<anonymous>)
at Function.from (native)
at UndoCommand._undo (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:29872:32)
at Array.editor.document.enqueueChanges (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:47229:30)
at Document.enqueueChanges (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:40085:30)
at UndoCommand.execute (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:47228:24)
at UndoCommand.on (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:5973:32)
at UndoCommand.fire (http://localhost:8125/ckeditor5-presets/tests/manual/article.js:4267:29)
The above error was reproduced on branch with a fix for https://github.com/ckeditor/ckeditor5-engine/issues/1001. On the current master first undo works, but the second gives:
basic-transformations.js:67 Uncaught TypeError: Cannot read property 'getNode' of undefined
at addTransformationCase (basic-transformations.js:67)
at Object.transform (transform.js:59)
at Object.transformDeltaSets (transform.js:261)
at Document.transformDeltas (document.js:359)
at UndoCommand._undo (basecommand.js:140)
at Array.editor.document.enqueueChanges (undocommand.js:40)
at Document.enqueueChanges (document.js:241)
at UndoCommand.execute (undocommand.js:39)
at UndoCommand.on (observablemixin.js:327)
at UndoCommand.fire (emittermixin.js:281)
This is not a regression but it's a bug worth checking anyway.
Edit by LukaszGudel: Undo block quote is now correctly creating 2 nested list items. Fixed.
The above might be one of "cannot fix with how converters work now" bug. There are actually 6 tests in integration of undo with lists that are intentionally skipped because they are failing. These are the cases that cannot be (at least easily) solved with current state of how conversion works. We skipped them to deliver Nested Lists feature faster.
If we change conversion to happen on changesDone
those cases will be probably easier to solve and then we can get back to them.
position.js:221 Uncaught TypeError: Cannot read property 'root' of undefined
at Position.compareWith (position.js:221)
at Position.isEqual (position.js:411)
at addTransformationCase (basic-transformations.js:396)
at Object.transform (transform.js:59)
at Object.transformDeltaSets (transform.js:261)
at Document.transformDeltas (document.js:359)
at UndoCommand._undo (basecommand.js:140)
at Array.editor.document.enqueueChanges (undocommand.js:40)
at Document.enqueueChanges (document.js:241)
at UndoCommand.execute (undocommand.js:39)
OS: Windows 10, MacOS X Browser: Chrome, Safari, Edge, Firefox, Opera Release: 0.10.0
position.js:221 Uncaught TypeError: Cannot read property 'root' of undefined
at Position.compareWith (position.js:221)
at Position.isEqual (position.js:411)
at addTransformationCase (basic-transformations.js:402)
at Object.transform (transform.js:59)
at Object.transformDeltaSets (transform.js:261)
at Document.transformDeltas (document.js:359)
at UndoCommand._undo (basecommand.js:140)
at Array.editor.document.enqueueChanges (undocommand.js:40)
at Document.enqueueChanges (document.js:241)
at UndoCommand.execute (undocommand.js:39)
The caret was moved to the end of the paragraph.
Selection restoring doesn't work correctly, we know about it and will change it, hopefully soon.
After I fixed this issue: https://github.com/ckeditor/ckeditor5-undo/issues/65#issuecomment-321190168 I noticed that undo+redo creates different content than it was at the beginning. It's worth to check why it happens. It fails even for fairly non-complicated copy paste. It has to be checked whether there is a bug in: copy/paste, OT or converters and whether this happens only for content with lists or also in other cases.
EDIT: Looks like it happens for copy paste whenever pasting is not into an empty element.
Block quote is removed after undo/redo operations.
The second paragraph has been removed.
Undo
4 times.There is the error in the console.
basic-transformations.js:270 Uncaught TypeError: Cannot read property 'root' of null
at addTransformationCase (basic-transformations.js:270)
at Object.transform (transform.js:59)
at Object.transformDeltaSets (transform.js:261)
at Document.transformDeltas (document.js:359)
at UndoCommand._undo (basecommand.js:140)
at Array.editor.document.enqueueChanges (undocommand.js:40)
at Document.enqueueChanges (document.js:241)
at UndoCommand.execute (undocommand.js:39)
at UndoCommand.on (observablemixin.js:327)
at UndoCommand.fire (emittermixin.js:281)
paragraph
.parag{
raph}
Undo doesn't merge the word.
Block quote was applied to the paragraph instead of moving paragraph to the end of the block quote.
See https://github.com/ckeditor/ckeditor5-engine/issues/1152
block quote
.Edit by LukaszGudel: Undoing list removal is now correctly restoring two items without adding third one. Fixed.
blockquote
below other block element.ckeditor.js:5 Uncaught o: move-operation-node-into-itself: Trying to move a range of nodes into one of nodes from that range. Read more: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/support/error-codes.html#move-operation-node-into-itself.
at d._execute (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:50554)
at x.applyOperation (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:246675)
at n (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:107507)
at o.move (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:108252)
at n (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:242104)
at t.a (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:243111)
at _.deleteContent (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:222073)
at _.on (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:29276)
at _.fire (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:23735)
at _.(anonymous function) [as deleteContent] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:29327)
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
block quote
.Divided word is missing bottom part.
Edit by LukaszGudel: Undoing is correctly restoring both lines. Fixed.
Heading 1
.Heading 1
.Editor crashes.
Uncaught o: model-nodelist-offset-out-of-bounds: Given offset cannot be found in the node list. Read more: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/support/error-codes.html#model-nodelist-offset-out-of-bounds.
at i.offsetToIndex (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:93655)
at l.offsetToIndex (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:13267)
at d.get index [as index] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:1937)
at d.get textNode [as textNode] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:2013)
at d.get nodeBefore [as nodeBefore] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:2196)
at h.getSelectedElement (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:73188)
at _updateCaptionVisibility (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:390795)
at _.listenTo (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:390524)
at _.fire (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:23714)
at _.(anonymous function) [as render] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:29306)
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
test
.t
and press Enter.t
e
s
t
Word has been restored, but characters have incorrect position - the result is tets
, instead of test
.
Edit by LukaszGudel: word is correctly restored with correct position of characters.
block quote
.block quote
.Deleted character from the first paragraph has been restored inside the block quote
.
Edit by LukaszGudel: Words are correctly restored. Fixed.
Heading 1
.Editor crashes.
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
block quote
icon.block quote
icon.Editor crashes
ckeditor.js:5 Uncaught o: move-operation-position-invalid: Source position or target position is invalid. Read more: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/support/error-codes.html#move-operation-position-invalid.
at i._execute (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:49878)
at x.applyOperation (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:246824)
at o._undo (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:202841)
at Array.editor.document.enqueueChanges (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:336109)
at x.enqueueChanges (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:247377)
at o.execute (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:336076)
at on (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:29255)
at o.fire (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:23714)
at o.(anonymous function) [as execute] (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:29306)
at o.execute (http://192.168.20.68:8125/ckeditor5-build-classic/tests/manual/ckeditor.js:75:220184)
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
Heading 1
.First character of the word has been moved to the new line.
Edit by LukaszGudel: Text in heading is correctly restored. Fixed.
Editor crashes.
ckeditorerror.js:46 Uncaught CKEditorError: model-position-path-incorrect: Position path must be an array with at least one item. Read more: https://ckeditor5.github.io/docs/nightly/ckeditor5/latest/framework/guides/support/error-codes.html#model-position-path-incorrect.
{"path":[]}
at new Position (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:237:10)
at addTransformationCase (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:47295:24)
at Object.transform (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:31648:23)
at Object.transformDeltaSets (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:31851:34)
at Document.transformDeltas (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:42588:77)
at UndoCommand._undo (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:36858:37)
at Array.editor.document.enqueueChanges (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:55081:30)
at Document.enqueueChanges (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:42470:30)
at UndoCommand.execute (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:55080:24)
at UndoCommand.on (http://192.168.20.68:8125/ckeditor5-core/tests/manual/article.js:5873:32)
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
The word from the second paragraph has been moved to the third paragraph.
Edit by LukaszGudel: paragraphs are correctly restored.
Characters deleted in step 3 appeared in the first paragraph.
Edit by LukaszGudel: Paragraphs are correctly restored. Fixed
I have a feeling that many new errors connected with Undo are regressions after a change in deleteContents
we merged very recently. I am sure that at least one of them is, as I tested it. This means that we will have to solve this in OT, or revert the change.
Could you report this in the engine and check it there?
<p>
s.The unwrapped paragraph is moved to the beginning.
Edit by LukaszGudel: Current behaviour is slightly different.
Block quotes have been restored in reversed order.
Edit by LukaszGudel: Blocks are restored in correct order.
H
at Heading 1
.Word has been restored incorrectly.
Edit by LukaszGudel: Characters in heading are correctly restored.
OL List item 2
and drag it to the first Quote
.block quote
.Whole block quote
has disappeared.
Edit by Lukasz Gudel: Content looks the same as before applying block quote. There is no content lost. Fixed.
block quote
icon.Editor crashes
mapper.js:398 Uncaught TypeError: Cannot read property 'is' of undefined
at Mapper._findPositionIn (mapper.js:398)
at Mapper.on (mapper.js:73)
at Mapper.fire (emittermixin.js:269)
at Mapper.toViewPosition (mapper.js:237)
at ModelConversionDispatcher.<anonymous> (model-selection-to-view-converters.js:86)
at ModelConversionDispatcher.fire (emittermixin.js:269)
at ModelConversionDispatcher.convertSelection (modelconversiondispatcher.js:253)
at Model.EditingController.listenTo (editingcontroller.js:126)
at Model.fire (emittermixin.js:269)
at Model._runPendingChanges (model.js:209)
Here is the first bad commit - https://github.com/ckeditor/ckeditor5-image/commit/7a1ab67059127a9b8759d5a106738907ae14c84d
Edit by LukaszGudel: I can not recreate this issue using those steps. It's possible that it is fixed but it would be better if someone confirms this.
The content is different than at the beginning
After undo the content is same as before deleting the text
Edit by LukaszGudel: Content is the same as before deleting the text. Fixed.
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).
Since we know that there a lot of issues with undo found after the recent refactoring let's report them in one place.