When editing table data in a text note, CKEditor 5 suddenly crashes. #311

Closed
opened 2025-10-01 15:50:54 -05:00 by giteasync · 5 comments
Owner

Originally created by @SiriusXT on GitHub.

Description

This issue seems to occur only when the toolbar is floating.

Steps to reproduce:

  1. Insert a table and enter some sample data.

  2. Select part of the text within a cell.

  3. Type directly on the keyboard to replace the selected text.

  4. The editor is likely to crash unexpectedly at this point.

TriliumNext Version

0.94.0, 0.94.1

What operating system are you using?

Windows

What is your setup?

Local + server sync

Operating System Version

windows11

Error logs

Interestingly, different browsers throw different errors.

Firefox throws:

Object { message: "Index or size is negative or greater than the allowed amount\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Index or size is negative or greater than the allowed amount", stack: "viewRangeToDom@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:15911:14\ntarget@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:58465:68\ngetDomElement@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:51112:26\nattachTo@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50189:33\n_startPinning@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50292:15\npin@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50261:15\nupdatePosition@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/othe…", filename: "http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1", lineno: 3711, colno: 5, date: 1749303465796 }

Electron and Edge throw:

Uncaught CKEditorError: Failed to execute 'setEnd' on 'Range': The offset 4 is larger than the node's length (3).
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Failed to execute 'setEnd' on 'Range': The offset 4 is larger than the node's length (3).
at $p.viewRangeToDom (layout_commons.js:908:71630)
at target (layout_commons.js:984:74931)
at Qf (layout_commons.js:978:21108)
at Gl.attachTo (layout_commons.js:978:15318)
at Gl._startPinning (layout_commons.js:978:16348)
at Gl.pin (layout_commons.js:978:15953)
at on.updatePosition (layout_commons.js:984:62822)
at Px (layout_commons.js:1018:23695)
at on. (layout_commons.js:1018:23460)
at on.fire (layout_commons.js:824:1598)

Originally created by @SiriusXT on GitHub. ### Description **This issue seems to occur only when the toolbar is floating.** Steps to reproduce: 1. Insert a table and enter some sample data. 2. Select part of the text within a cell. 3. Type directly on the keyboard to replace the selected text. 4. The editor is likely to crash unexpectedly at this point. ### TriliumNext Version 0.94.0, 0.94.1 ### What operating system are you using? Windows ### What is your setup? Local + server sync ### Operating System Version windows11 ### Error logs Interestingly, different browsers throw different errors. #### Firefox throws: Object { message: "Index or size is negative or greater than the allowed amount\nRead more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Index or size is negative or greater than the allowed amount", stack: "viewRangeToDom@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:15911:14\ntarget@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:58465:68\ngetDomElement@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:51112:26\nattachTo@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50189:33\n_startPinning@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50292:15\npin@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1:50261:15\nupdatePosition@http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/othe…", filename: "http://localhost:4200/assets/v0.94.1/@fs/X:/workspace/others/trilium/Notes/node_modules/.vite/apps/client/deps/ckeditor5.js?v=1909f8b1", lineno: 3711, colno: 5, date: 1749303465796 } #### Electron and Edge throw: Uncaught CKEditorError: Failed to execute 'setEnd' on 'Range': The offset 4 is larger than the node's length (3). Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-Failed to execute 'setEnd' on 'Range': The offset 4 is larger than the node's length (3). at $p.viewRangeToDom (layout_commons.js:908:71630) at target (layout_commons.js:984:74931) at Qf (layout_commons.js:978:21108) at Gl.attachTo (layout_commons.js:978:15318) at Gl._startPinning (layout_commons.js:978:16348) at Gl.pin (layout_commons.js:978:15953) at on.updatePosition (layout_commons.js:984:62822) at Px (layout_commons.js:1018:23695) at on.<anonymous> (layout_commons.js:1018:23460) at on.fire (layout_commons.js:824:1598)
Author
Owner

@eliandoran commented on GitHub:

Interestingly, this is a different way to trigger TriliumNext/trilium#5781 , so let's treat it there.

@eliandoran commented on GitHub: Interestingly, this is a different way to trigger TriliumNext/trilium#5781 , so let's treat it there.
Author
Owner

@dosubot[bot] commented on GitHub:

Hi @SiriusXT! I'm Dosu and I’m helping the Notes team.

This is a known bug in TriliumNext 0.94.0 and 0.94.1, likely caused by the upgrade of CKEditor from version 42 to 45, which changed some editor behaviors and introduced issues with text selection and editing—especially with the floating toolbar and tables. The crash is reproducible and affects multiple browsers, each showing slightly different errors.

There are two confirmed workarounds: change the theme in TriliumNext, or (if using Firefox) enable the Dark Reader extension for the Trilium site. Copy/paste still works even if selection is invisible. A fix is planned for the next version of TriliumNext. More details and discussion are available here.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub: <!-- Greeting --> Hi @SiriusXT! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the Notes team. <!-- Answer --> This is a known bug in TriliumNext 0.94.0 and 0.94.1, likely caused by the upgrade of CKEditor from version 42 to 45, which changed some editor behaviors and introduced issues with text selection and editing—especially with the floating toolbar and tables. The crash is reproducible and affects multiple browsers, each showing slightly different errors. There are two confirmed workarounds: change the theme in TriliumNext, or (if using Firefox) enable the Dark Reader extension for the Trilium site. Copy/paste still works even if selection is invisible. A fix is planned for the next version of TriliumNext. More details and discussion are available [here](https://github.com/orgs/TriliumNext/discussions/2141). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e08aff9a-2ae1-4cc0-8dc9-d8b43c723586?feedback_type=other)</sup>&nbsp;&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/TriliumNext/Notes/issues/2203)
Author
Owner

@eliandoran commented on GitHub:

@SiriusXT , how easy is it to reproduce? On my side I can't seem to trigger it.

@eliandoran commented on GitHub: @SiriusXT , how easy is it to reproduce? On my side I can't seem to trigger it.
Author
Owner

@eliandoran commented on GitHub:

@SiriusXT , you're right, I mistakenly thought that I had the floating toolbar enabled.

@eliandoran commented on GitHub: @SiriusXT , you're right, I mistakenly thought that I had the floating toolbar enabled.
Author
Owner

@SiriusXT commented on GitHub:

@eliandoran Huh, that’s odd — it’s consistently reproducible on my end, even across different machines.
Note: the toolbar needs to be floating for the issue to occur.
Here’s a screen recording of the reproduction in a sandboxed environment:
https://github.com/user-attachments/assets/d36f32a8-91ad-4adc-a43c-b9715afbdae4

@SiriusXT commented on GitHub: @eliandoran Huh, that’s odd — it’s consistently reproducible on my end, even across different machines. Note: the toolbar needs to be floating for the issue to occur. Here’s a screen recording of the reproduction in a sandboxed environment: https://github.com/user-attachments/assets/d36f32a8-91ad-4adc-a43c-b9715afbdae4
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TriliumNext/Trilium#311
No description provided.