From 58cd8244ba49987beb69ce589e063851530e0770 Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Thu, 22 Jan 2026 08:24:37 +0800 Subject: [PATCH] Fix markdown newline handling during IME composition (#36421) ### Summary Fix incorrect newline handling in markdown editor when using IME input. ### Details While composing text with an IME, pressing Enter should not trigger markdown indentation logic. This change skips indentation handling during composition by checking `e.isComposing`. This prevents unexpected line breaks and formatting issues for CJK users. --- web_src/js/features/comp/EditorMarkdown.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/features/comp/EditorMarkdown.ts b/web_src/js/features/comp/EditorMarkdown.ts index da7bbcfef7..cdc9bdaf9a 100644 --- a/web_src/js/features/comp/EditorMarkdown.ts +++ b/web_src/js/features/comp/EditorMarkdown.ts @@ -186,6 +186,7 @@ export function markdownHandleIndention(tvs: TextareaValueSelection): MarkdownHa } function handleNewline(textarea: HTMLTextAreaElement, e: KeyboardEvent) { + if (e.isComposing) return; const ret = markdownHandleIndention({value: textarea.value, selStart: textarea.selectionStart, selEnd: textarea.selectionEnd}); if (!ret.handled || !ret.valueSelection) return; // FIXME: the "handled" seems redundant, only valueSelection is enough (null for unhandled) e.preventDefault();