From b4fefa94d72cd381ccdd1dcb359ade0371203cce Mon Sep 17 00:00:00 2001 From: johnnyjoygh Date: Mon, 27 Jul 2026 22:05:16 +0800 Subject: [PATCH] fix(editor): restore Windows emoji input --- web/src/components/MemoEditor/Editor/extensions.ts | 6 ++++++ web/tests/editor.test.tsx | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/web/src/components/MemoEditor/Editor/extensions.ts b/web/src/components/MemoEditor/Editor/extensions.ts index 52a8a642..167acb5b 100644 --- a/web/src/components/MemoEditor/Editor/extensions.ts +++ b/web/src/components/MemoEditor/Editor/extensions.ts @@ -80,6 +80,12 @@ export function buildEditorExtensions({ markdown({ extensions: [GFM] }), ...memoEditorTheme, EditorView.lineWrapping, + // CodeMirror defaults to autocorrect="off" because it is primarily a code + // editor. Memos is a prose editor, and leaving that default in place also + // routes Windows TSF input (including the Win+. emoji picker) through + // Chrome's autocorrect-suppression path, which has dropped committed text. + // Restore the browser default used by the textarea editor before v0.30. + EditorView.contentAttributes.of({ autocorrect: "on" }), placeholderCompartment.of(cmPlaceholder(placeholder)), EditorView.domEventHandlers({ paste: (event) => { diff --git a/web/tests/editor.test.tsx b/web/tests/editor.test.tsx index 47f44cde..96b53d8c 100644 --- a/web/tests/editor.test.tsx +++ b/web/tests/editor.test.tsx @@ -43,6 +43,20 @@ describe("Editor", () => { expect(onChange).toHaveBeenCalledWith("hello"); }); + it("keeps native autocorrection enabled for Windows text services", () => { + const props = { + className: "x", + initialContent: "", + placeholder: "memo", + onContentChange: vi.fn(), + onFiles: vi.fn(), + onSubmit: vi.fn(), + }; + const { container } = render(); + + expect(container.querySelector(".cm-content")).toHaveAttribute("autocorrect", "on"); + }); + it("reconfigures the placeholder when its translation changes", () => { const props = { className: "x",