Darginec05 / Yoopta-Editor

Build Notion-like, Craft-like, Coda-like, Medium-like editors with Yoopta
https://yoopta.dev/
MIT License
1.46k stars 112 forks source link

[BUG] (on Mac) The cursor's behavior doesn't match expectations when the "enter" or "delete" (backspace) key is pressed in a Mandarin input context #396

Open effie77777 opened 1 week ago

effie77777 commented 1 week ago

Has this bug been raised before?

Description

[edit]: I found it works fine on Windows, but the issues appear on Mac.

Hi, I'm a Mandarin user. I encountered some problems when typing in Mandarin. I'm aware that it may be hard to fix the issues or even just understanding what others are talking about when someone is unfamiliar with that language. So, I'd like to briefly explain how a Mandarin word is formed first.

Please refer to the video attached. In Mandarin, a meaningful character/word is composed with multiple segments (kind of like letters in English). For example, the character/word "羅" is composed with four segments, including "ㄌ", "ㄨ", "ㄛ", and the tone indicator, as shown in the video. When I'm still working with the segments and haven't completed the "composition" process yet, the underscores will appear and stay.

Now, suppose the character/word "羅" has already appeared. At this point, the underscore still exists. If I press "enter" key, the underscore disappears, and the cursor jumps to the next line automatically. (Ideally, the cursor should stay on the current line.) Similarly, if I press "delete" key, all of the segments disappear, and the cursor jumps to the previous line automatically. (Ideally, only the last segment should be deleted, and the cursor should stay on the current line.)

I think these issues have something to do with the way the editor handles inputs in Mandarin. That is, when one is typing in Mandarin, a series of events are triggered, with the "compositionstart" event being the first, followed by the "compositionupdate" event and the "compositionend" event, and finally "input" event. This is different from how English inputs are handled.

--------------- That's all. Thanks very much for your time. Any suggestions or directions of fixing these issues would be much appreciated!

Screenshots

https://github.com/user-attachments/assets/09675d24-b8c0-47b4-879d-86e9041062f9

Do you want to work on this issue?

Yes

effie77777 commented 1 week ago

Hi, I found that these issues seem to appear only on Mac but not on Windows. I added this point in the title and the description section.

Thanks again!