zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.37k stars 1.92k forks source link

(Bug report) write math inline, the text panel will delete things that i wrote before #3121

Open YHLpuyu opened 2 years ago

YHLpuyu commented 2 years ago

Trilium Version

0.54.2

What operating system are you using?

Windows

What is your setup?

Local (no sync)

Operating System Version

windows 10 21H2

Description

in textnote, when there have some math inline. the content wrote before is deleted by trilium, an can't redo with ctrl+z. That's a disaster for a notion app. in dev panel , it shows many error: Uncaught error: Message: Uncaught CKEditorError: model-nodelist-offset-out-of-bounds {"offset":206,"nodeList":[{"attributes":{"equation":"V_{i_2}","type":"span","display":false},"name":"mathtex-inline"},{"data":"An "},{"attributes":{"italic":true},"data":"ear of a polygon"},{"data":" is a triangle formed by three consecutive vertices "}]} Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-nodelist-offset-out-of-bounds, URL: , Line: 6, Column: 349970, Error object: {"name":"CKEditorError","context":[{"attributes":{"equation":"V_{i_2}","type":"span","display":false},"name":"mathtex-inline"},{"data":"An "},{"attributes":{"italic":true},"data":"ear of a polygon"},{"data":" is a triangle formed by three consecutive vertices "}],"data":{"offset":206,"nodeList":[{"attributes":{"equation":"V_{i_2}","type":"span","display":false},"name":"mathtex-inline"},{"data":"An "},{"attributes":{"italic":true},"data":"ear of a polygon"},{"data":" is a triangle formed by three consecutive vertices "}]}}, Stack: CKEditorError: model-nodelist-offset-out-of-bounds {"offset":206,"nodeList":[{"attributes":{"equation":"V_{i_2}","type":"span","display":false},"name":"mathtex-inline"},{"data":"An "},{"attributes":{"italic":true},"data":"ear of a polygon"},{"data":" is a triangle formed by three consecutive vertices "}]} Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-nodelist-offset-out-of-bounds at Wa.offsetToIndex (<anonymous>:6:495042) at Ua.offsetToIndex (<anonymous>:6:496022) at Ka (<anonymous>:6:506512) at ja._previous (<anonymous>:6:499232) at ja.next (<anonymous>:6:498175) at <anonymous>:6:638790 at _d.modifySelection (<anonymous>:6:638927) at _d.<anonymous> (<anonymous>:6:361677) at _d.fire (<anonymous>:6:351884) at _d.<computed> [as modifySelection] (<anonymous>:6:361729) Uncaught CKEditorError: model-nodelist-offset-out-of-bounds {"offset":206,"nodeList":[{"attributes":{"equation":"V_{i_2}","type":"span","display":false},"name":"mathtex-inline"},{"data":"An "},{"attributes":{"italic":true},"data":"ear of a polygon"},{"data":" is a triangle formed by three consecutive vertices "}]} Read more: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html#error-model-nodelist-offset-out-of-bounds at Wa.offsetToIndex (<anonymous>:6:495042) at Ua.offsetToIndex (<anonymous>:6:496022) at Ka (<anonymous>:6:506512) at ja._previous (<anonymous>:6:499232) at ja.next (<anonymous>:6:498175) at <anonymous>:6:638790 at _d.modifySelection (<anonymous>:6:638927) at _d.<anonymous> (<anonymous>:6:361677) at _d.fire (<anonymous>:6:351884) at _d.<computed> [as modifySelection] (<anonymous>:6:361729) the content I write is below, some content has been deleted :

An ear of a polygon is a triangle formed by three consecutive vertices  \(V_{i_0}\)\(V_{i_1}\), and  \(V_{i_2}\) for which  \(V_{i_1}\) is a  \(convex\)  \(vertex\). At such a vertex, the interior angle at the vertex is smaller than  \(\pi\) radians and the line segment from  \(V_{i_0}\)

YHLpuyu commented 2 years ago

lxs

sigaloid commented 2 years ago

I just experienced this not 30 seconds ago and was about to report it :sweat_smile:

For now I'm just typing on a new line then backspacing the new line once I'm done. Maybe that will help temporarily.

YHLpuyu commented 2 years ago

I quit, and start using markdown files in folder. I don't want lose content.

XXXJetfireXXX commented 2 years ago

Even though the issue is 'closed', I don't think that the problem is actually solved. Maybe we should reopen it? @zadam Though I just tried to reproduce it and didn't succeed so far.

sindzicat commented 1 year ago

I have the same issue. Any progress? I don't want to lose my content.

sindzicat commented 1 year ago

Here, how to fix error "model-nodelist-offset-out-of-bounds" in ckeditor docs: https://ckeditor.com/docs/ckeditor5/latest/framework/guides/tutorials/implementing-an-inline-widget.html#fixing-position-mapping

zadam commented 1 year ago

Hi, is this reproducible on https://jsfiddle.net/isaul32/3wjrkLdv/ ? (the ckeditor5-math's demo)