ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.61k stars 336 forks source link

[Bug]: Japanese IME input issue with multi-line selection in ProseMirror editor #1482

Open honoka-anraku opened 3 weeks ago

honoka-anraku commented 3 weeks ago

Bug Description When selecting multiple lines of text in the ProseMirror editor and attempting to input Japanese characters using IME, the following issues occur:

Steps to Reproduce:

  1. Open the ProseMirror editor.
  2. Enter two lines of text:
    • First line: Katakana characters (e.g., "テスト")
    • Second line: One Hiragana character (e.g., "あ")
  3. Select both lines of text.
  4. Attempt to input the same Hiragana character as in the second line.
  5. Observe that the first line disappears, but the second line remains unchanged, and further Japanese input is impossible.

Browser Used Chrome

Code Example URL https://prosemirror.net/examples/basic/

Expected Behavior When selecting multiple lines and inputting Japanese characters, all selected text should be replaced with the new input, and Japanese input should continue to function normally.

Additional Context (Optional)

marijnh commented 3 weeks ago

It seems the browser deletes all paragraph nodes and starts composing in a naked text node at the top level of the editor in this situation. That confused ProseMirror's composition handling. Could you see if attached patch helps for you?