AppFlowy-IO / appflowy-editor

A highly customizable rich-text editor for Flutter. The AppFlowy Editor project for AppFlowy and beyond.
https://pub.dev/packages/appflowy_editor
Other
434 stars 183 forks source link

[Bug] Key Presses Affect Document Actions During Japanese Conversion Menu Usage #865

Open keita06 opened 1 month ago

keita06 commented 1 month ago

Bug Description

When using Japanese input within a document implemented with your library, I encountered an issue where key presses such as the up/down arrow keys or the spacebar, which are intended for navigating the prediction menu, also trigger actions in the document itself. This causes disruptions in the text conversion process, as both the prediction menu and the document are responding to the same key events. This issue does not occur every time, but it happens with high frequency, making it difficult to consistently complete text conversion.

This is my first time submitting an issue, so please let me know if additional information is needed or if there’s anything I should adjust in the report.

https://github.com/user-attachments/assets/280c0465-1ac6-4b57-b426-aa16ea97ece6

How to Reproduce

  1. Open a document using the library.
  2. Start typing in Japanese using an IME (Input Method Editor).
  3. Observe that when the prediction menu appears, the cursor continues to focus on the document rather than interacting with the prediction menu.

Expected Behavior

When using the up/down arrow keys or the spacebar during Japanese input, I expect the focus to remain on the prediction menu, allowing me to navigate through and select conversion options without affecting the document. The document cursor should not move or trigger any actions during this process, ensuring that text conversion happens smoothly and correctly.

Operating System

macos (Apple M2)

AppFlowy Editor Version(s)

main repository

Screenshots

No response

Additional Context

No response

keita06 commented 2 weeks ago

@LucasXu0 When using IME to input Japanese, typically two Roman characters are used to input a single character. However, in AppFlowy, it's possible that the markdown processing is triggered as soon as the first Roman character is input. At this point, the character input is not yet complete and is still in an editing state, which could cause issues within the markdown processing.

keita06 commented 2 weeks ago

@LucasXu0 The input issue with Japanese conversion might be caused by enabling "Live Conversion" on MacOS's Japanese input while using Flutter 3.22. https://github.com/flutter/flutter/issues/149379

Additionally, when using an IME with "Live Conversion" turned off, the full-width space in Japanese text is not interpreted correctly. After typing a full-width space and then typing a word, the full-width space suddenly appears during input.

LucasXu0 commented 2 weeks ago

@keita06 Thanks for reporting and testing! I'll do a search about "Live Conversion". By the way, have you tried using Flutter 3.24?

Additionally, you can turn on the log and post it here. That way, I can check the IME output.

editorState.logConfiguration
  ..handler = debugPrint
  ..level = LogLevel.off;
keita06 commented 2 weeks ago

@LucasXu0 Since the issue regarding Japanese live conversion hasn't been resolved yet, I haven't upgraded to Flutter 3.24 to test it. If possible, I would like to downgrade to Flutter 3.19 to test it. Is appflowy_editor usable with Flutter 3.19?

LucasXu0 commented 2 weeks ago

The version 2.4.0 is compatible with Flutter 3.19.

keita06 commented 2 weeks ago

Do I need to use Flutter 3.20 or later to use version 3.1.0?

LucasXu0 commented 2 weeks ago

You can use flutter 3.19.0