fix: editor IME composing event behavior (#3267)

* fix: editor IME composing event behavior

* fix: editor IME composing event behavior

* Update web/src/components/MemoEditor/hooks/useAutoComplete.ts

---------

Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
SkyWT 2024-04-25 08:59:26 +08:00 committed by GitHub
parent 205bf7ed0e
commit 9bcd4f59a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,9 @@ const useAutoComplete = (actions: EditorRefActions) => {
editor.addEventListener("keydown", (event) => {
if (event.key === "Enter") {
if (event.isComposing) {
return;
}
const cursorPosition = actions.getCursorPosition();
const prevContent = actions.getContent().substring(0, cursorPosition);
const lastNode = last(window.parse(prevContent));