0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-25 14:55:20 +01:00

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.
This commit is contained in:
Tyrone Yeh 2026-01-22 08:24:37 +08:00 committed by GitHub
parent 111c822a30
commit 58cd8244ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();