From 9bcd4f59a263d2a294f68523d9c390688cff8cd1 Mon Sep 17 00:00:00 2001 From: SkyWT Date: Thu, 25 Apr 2024 08:59:26 +0800 Subject: [PATCH] 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 --- web/src/components/MemoEditor/hooks/useAutoComplete.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/src/components/MemoEditor/hooks/useAutoComplete.ts b/web/src/components/MemoEditor/hooks/useAutoComplete.ts index eb104e461..e28e1b1c1 100644 --- a/web/src/components/MemoEditor/hooks/useAutoComplete.ts +++ b/web/src/components/MemoEditor/hooks/useAutoComplete.ts @@ -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));