ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
26.81k stars 2.24k forks source link

CJK compatibility issue: last character gets disappered when newline is inserted #2545

Closed devunt closed 2 years ago

devunt commented 2 years ago

What’s the bug you are facing?

I'm having a issue with typing Hangul (Korean alphabet) characters in Tiptap.

As single Hangul character is composited with multiple keystroke, every Hangul character entered in computer will be in "composting" state first, and get changed to "composited" state after composition of one character is finished or it is interrupted by typing other than Hangul character such as Latin alphabet or puncutation, or even arrow keys. [1]

If Enter key is pressed while Hangul character is in compositing state, that character gets disappeared.

Due to nature of this composition-based input system which is differ from latin-based characters, this bug is widely observed across many rich text editors including Tiptap and Draft.js [2]. I can confirm this issue happens in Tiptap, Prosemirror (seems obvious since Tiptap is based on Prosemirror), Dante 3 (also seems obvious since it is based on Tiptap), CKEditor but not happens in Quill, Slate, TinyMCE or Froala.

[1] https://medium.com/square-corner-blog/understanding-composition-browser-events-f402a8ed5643 [2] https://github.com/facebook/draft-js/issues/1632

How can we reproduce the bug on our side?

  1. Input Hangul character.
  2. Press the Enter key.
  3. Last character (the compositing character) gets disappeared.

Can you provide a CodeSandbox?

No response

What did you expect to happen?

The last character shoud be intact in place.

Anything to add? (optional)

With Tiptap

https://user-images.githubusercontent.com/337728/154540055-5cc687b7-bb37-418b-9ac7-e400cb4bfaa9.mov

With quill.js

https://user-images.githubusercontent.com/337728/154541362-b3ac86f8-cecb-4fd5-a14f-4463dc7ad9f3.mov

Did you update your dependencies?

Are you sponsoring us?

philippkuehn commented 2 years ago

Can you try this in a plain ProseMirror editor please? https://prosemirror.net/

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.