Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
honoka-anraku opened this issue Aug 19, 2024 · 1 comment

Comments

@honoka-anraku
Copy link

honoka-anraku commented Aug 19, 2024

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

  • Japanese input becomes impossible.
  • Only the first line of the selected text is deleted, while the second and subsequent lines remain unchanged.

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)

  • This issue does not occur if all lines contain only Katakana or Hiragana.
  • The issue does not occur if the editor loses focus and regains it after the initial text input.
  • This bug appears to be ProseMirror-specific, as it can be reproduced in other online ProseMirror demos.
marijnh added a commit to ProseMirror/prosemirror-view that referenced this issue Aug 19, 2024
…election

FIX: When the browser starts a composition and the selection spans across blocks,
start by clearing it to make sure the composed text node lands in a valid position.

Issue ProseMirror/prosemirror#1482
@marijnh
Copy link
Member

marijnh commented Aug 19, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants