ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
8.71k stars 3.62k forks source link

IME: errors when typing in Burmese language on Windows #14350

Open FilipTokarski opened 1 year ago

FilipTokarski commented 1 year ago

πŸ“ Provide detailed reproduction steps (if any)

  1. Use Windows machine
  2. Open editor demo
  3. Change language to Myanmar (Visual Order)
  4. Type the following sequence: tm;vHk;yJ tqifayjujygap>

βœ”οΈ Expected result

You are able to type the full sequence. Text composes properly- α€‘α€¬α€Έα€œα€―α€Άα€Έα€•α€² α€‘α€†α€„α€Ίβ€Œα€•α€Όα€±α€€α€Όα€•α€«α€…α€±α‹

❌ Actual result

Not able to finish typing, composition stops just before few last characters. If you then put cursor after this text and start typing, errors are thrown:

Uncaught CKEditorError: model-nodelist-offset-out-of-bounds {"offset":23,"nodeList":[{"data":"α€‘α€¬α€Έα€œα€―α€Άα€Έα€•α€² ထဆင်ပြေကြပါ"}]}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-model-nodelist-offset-out-of-bounds
   at va.offsetToIndex (ck-demo-external-feature-rich-e4b9a235dc.js:2:654301)
   at _a.offsetToIndex (ck-demo-external-feature-rich-e4b9a235dc.js:2:657026)
   at Da (ck-demo-external-feature-rich-e4b9a235dc.js:2:667738)
   at get textNode [as textNode] (ck-demo-external-feature-rich-e4b9a235dc.js:2:662150)
   at Ac (ck-demo-external-feature-rich-e4b9a235dc.js:2:799762)
   at vc._validateSelectionRange (ck-demo-external-feature-rich-e4b9a235dc.js:2:799598)
   at qa._validateSelectionRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:697698)
   at qa._replaceAllRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:697477)
   at qa._setRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:688630)
   at qa.setTo (ck-demo-external-feature-rich-e4b9a235dc.js:2:687738)

Uncaught CKEditorError: insert-operation-position-invalid
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-insert-operation-position-invalid
   at ql._validate (ck-demo-external-feature-rich-e4b9a235dc.js:2:748272)
   at Oc.on.priority (ck-demo-external-feature-rich-e4b9a235dc.js:2:824101)
   at Oc.fire (ck-demo-external-feature-rich-e4b9a235dc.js:2:476345)
   at <computed> [as applyOperation] (ck-demo-external-feature-rich-e4b9a235dc.js:2:480064)
   at Ec.insert (ck-demo-external-feature-rich-e4b9a235dc.js:2:805599)
   at Pc._insertPartialFragment (ck-demo-external-feature-rich-e4b9a235dc.js:2:818131)
   at Pc.handleNodes (ck-demo-external-feature-rich-e4b9a235dc.js:2:816742)
   at ck-demo-external-feature-rich-e4b9a235dc.js:2:826202
   at Oc.change (ck-demo-external-feature-rich-e4b9a235dc.js:2:828385)
   at Oc.<anonymous> (ck-demo-external-feature-rich-e4b9a235dc.js:2:825529)

Uncaught CKEditorError: model-nodelist-offset-out-of-bounds {"offset":24,"nodeList":[{"data":"α€‘α€¬α€Έα€œα€―α€Άα€Έα€•α€² ထဆင်ပြေကြပါ"}]}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-model-nodelist-offset-out-of-bounds
   at va.offsetToIndex (ck-demo-external-feature-rich-e4b9a235dc.js:2:654301)
   at _a.offsetToIndex (ck-demo-external-feature-rich-e4b9a235dc.js:2:657026)
   at Da (ck-demo-external-feature-rich-e4b9a235dc.js:2:667738)
   at get textNode [as textNode] (ck-demo-external-feature-rich-e4b9a235dc.js:2:662150)
   at Ac (ck-demo-external-feature-rich-e4b9a235dc.js:2:799762)
   at vc._validateSelectionRange (ck-demo-external-feature-rich-e4b9a235dc.js:2:799598)
   at qa._validateSelectionRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:697698)
   at qa._replaceAllRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:697477)
   at qa._setRanges (ck-demo-external-feature-rich-e4b9a235dc.js:2:688630)
   at qa.setTo (ck-demo-external-feature-rich-e4b9a235dc.js:2:687738)

❓ Possible solution

If you have ideas, you can list them here. Otherwise, you can delete this section.

πŸ“ƒ Other details


If you'd like to see this fixed sooner, add a πŸ‘ reaction to this post.

Witoso commented 1 year ago

@FilipTokarski could you check how it behaves on MacOS?

FilipTokarski commented 1 year ago

macOs Chrome: Screenshot 2023-06-12 at 12 20 29

macOs Firefox: Screenshot 2023-06-12 at 12 20 18

Composition finishes properly. However, the first part has a bit different characters.

slotterbackW commented 6 months ago

Wanted to add two additional key sequences that we've heard cause issues with CKEditor + Windows to provide more reproduction steps.

Witoso commented 6 months ago

@FilipTokarski could you check the behavior of those short sequences on Windows again?

FilipTokarski commented 5 months ago

Chceked on latest (41.0.0) docs and I'm not able to reproduce the error.

Witoso commented 5 months ago

@FilipTokarski does it result in the exact values?

  • Typing awmh should produce တော့
  • Typing taumifh should produce ထကောင့်
FilipTokarski commented 5 months ago

Yes, those were working ok for me as well.

Witoso commented 5 months ago

Based on the above @slotterbackW any chance you could organize tests with your power users on the testing of native Windows IME? It's much easier to debug this one for us than the KeyMagic one.

slotterbackW commented 5 months ago

Yep I asked them yesterday! They came back and said

Firstly we attempted to enter စေ။ by typing ap>. It worked perfectly. We then tried to enter ပါစေ။ by typing ygap>, and we managed to reproduce the issue. We could see that after typing ygap, the blinking cursor disappeared as CKEditor had lost focus. At this point of time, typing > resulted nothing to the editor. When I pressed the space bar, the scrollbar immediately jumped to the end of the page. I had to click into the editor again to resume typing. I could see that the underline did not go away after typing >

Just restating, sounds like typing ygap using the Myanmar (Visual Order) keyboard on Windows caused the editor to lose focus once the p was typed. This was after typing another set of characters so not sure if that's a factor or not.

FilipTokarski commented 5 months ago

typing ygap using the Myanmar (Visual Order) keyboard on Windows caused the editor to lose focus once the p was typed

Yes, I can reproduce this behaviour. It manifests in two ways:

FilipTokarski commented 5 months ago

Oh, actually if you type ygap in the empty editor and then when you focus the editor again (just click in the editing area), you get the error that was reported in the initial message:

Uncaught CKEditorError: model-nodelist-offset-out-of-bounds

So unfortunately it's still there.

niegowski commented 1 month ago

We were researching this issue. The problem is that for this language, the browser is not firing the compositionend event after typing ygap, instead it moves the selection forward, in most cases by 2 characters. If the typed phrase is at the end of the editor, then the selection jumps to the nearest text node after the editor. While typing inside some text, the selection jumps 2 characters forward. The same behavior can be reproduced in the plain content-editable element so this is a browser bug.

Since the compositionend event was not fired, the model is not updated and there is a misalignment between the DOM and model/view, and position mapping fails (the reported model-nodelist-offset-out-of-bounds error).

While debugging it we were looking for a workaround. This is a tricky case because without the compositionend event, we do not have the data to insert into the model (we do not use beforeinput insertCompositionText on desktop). We could try to monitor the document selection and try to "break" the composition if detected selection outside the composed range, but this is tricky since the composition does not provide API to stop it.

Since the above happens only in Chrome on Windows I'd like to check if implementing the EditContext could help resolving this issue.

Witoso commented 1 month ago

@niegowski can we report this issue to the Chromium with the reproduction steps?

niegowski commented 1 month ago

@niegowski can we report this issue to the Chromium with the reproduction steps?

Reported to Chromium: https://issues.chromium.org/issues/344767735

Witoso commented 1 month ago

@slotterbackW we will push it through Chromium support, it's possible that this also affects this KeyMagic bug (#14117), but I'm not sure. It's weird that both are related to Chrome + Windows.