Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] Crash when undoing row insertion and adding cell properties #6382

Closed
FilipTokarski opened this issue Mar 5, 2020 · 4 comments · Fixed by ckeditor/ckeditor5-engine#1834
Assignees
Labels
package:engine package:table type:bug This issue reports a buggy (incorrect) behavior.

Comments

@FilipTokarski
Copy link
Member

FilipTokarski commented Mar 5, 2020

📝 Provide detailed reproduction steps (if any)

  1. Go to tableselection test and add a table
  2. Select single cell or multiple cells
  3. Add row above or below
  4. Select the whole new row
  5. Open cell properties and add background color
  6. Without changing the selection, undo two times

✔️ Expected result

Undoing works just fine

❌ Actual result

Editor crashes:
table_undo2

NOTE: it is even easier to reproduce it on branch i/6114b - you can do it with or without changing the selection in step 6

Errors:

Uncaught CKEditorError: model-selection-range-intersects: Trying to add a range that intersects with another range in the selection. Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-selection-range-intersects
 {"addedRange":{"start":{"root":"main","path":[1,1,0],"stickiness":"toNext"},"end":{"root":"main","path":[1,1,1],"stickiness":"toPrevious"}},"intersectingRange":{"start":{"root":"main","path":[1,1,0],"stickiness":"toNext"},"end":{"root":"main","path":[1,1,1],"stickiness":"toPrevious"}}}
    at LiveSelection._checkRange (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:64846:11)
    at LiveSelection._prepareRange (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:51700:8)
    at LiveSelection._fixGraveyardSelection (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:52022:26)
    at Model.LiveSelection.listenTo.priority (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:51514:10)
    at Model.fire (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:124433:30)
    at Model.<computed> [as applyOperation] (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:126570:16)
    at UndoCommand._undo (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:119730:11)
    at Object.callback (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:120017:9)
    at Model._runPendingChanges (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:54477:58)
    at Model.enqueueChange (http://localhost:8125/ckeditor5-table/tests/manual/tableselection.js:53903:10)
Uncaught TypeError: Cannot read property 'getChildIndex' of null
    at TableUtils.getCellLocation (tableutils.js:59)
    at TableSelection.getSelectedTableCells (tableselection.js:214)
    at getSelectedTableCells.next (<anonymous>)
    at TableSelection._updateModelSelection (tableselection.js:265)
    at TableSelection.stopSelection (tableselection.js:180)
    at MouseSelectionHandler._handleMouseMove (mouseselectionhandler.js:99)
    at Document.<anonymous> (mouseselectionhandler.js:64)
    at Document.fire (emittermixin.js:209)
    at MouseEventsObserver.fire (domeventobserver.js:96)
    at MouseEventsObserver.onDomEvent (mouseeventsobserver.js:42)

📃 Other details

  • Browser: any
  • OS: any

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@FilipTokarski FilipTokarski added type:bug This issue reports a buggy (incorrect) behavior. package:table labels Mar 5, 2020
@Reinmar
Copy link
Member

Reinmar commented Mar 9, 2020

Could you paste the stack trace? It's very helpful when looking for similar issues. Often, similar issues give the same error and we can easily find duplicates this way.

@FilipTokarski
Copy link
Member Author

Wow sorry for that, I was sure I added the errors, must have missed something 🤦‍♂ Anyway, I updated the report.

@Reinmar
Copy link
Member

Reinmar commented Mar 24, 2020

There's a workaround in some remove col/row commands so they select the entire table before starting operating on cells. This works around the same issue – document selection is not able to properly manage its ranges when the document changes (cells are removed, ranges get insersected).

@Reinmar
Copy link
Member

Reinmar commented Mar 26, 2020

May be resolved by #6501.

@jodator jodator self-assigned this Mar 30, 2020
Reinmar added a commit to ckeditor/ckeditor5-engine that referenced this issue Apr 14, 2020
Fix: Intersecting ranges resulting when fixing graveyard selection no longer break the editor. Closes ckeditor/ckeditor5#6501. Closes ckeditor/ckeditor5#6382.
Reinmar added a commit to ckeditor/ckeditor5-table that referenced this issue Apr 14, 2020
Other: Removed temporary fixes for `model-selection-range-intersects` errors. See ckeditor/ckeditor5#6501. See ckeditor/ckeditor5#6382.
mlewand pushed a commit that referenced this issue May 1, 2020
Fix: Intersecting ranges resulting when fixing graveyard selection no longer break the editor. Closes #6501. Closes #6382.
mlewand pushed a commit that referenced this issue May 1, 2020
Other: Removed temporary fixes for `model-selection-range-intersects` errors. See #6501. See #6382.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine package:table type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants