diff --git a/web/src/components/MemoEditor/Editor/extensions.ts b/web/src/components/MemoEditor/Editor/extensions.ts index e3077d53..82869e55 100644 --- a/web/src/components/MemoEditor/Editor/extensions.ts +++ b/web/src/components/MemoEditor/Editor/extensions.ts @@ -81,12 +81,16 @@ export function buildEditorExtensions({ markdown({ extensions: memoMarkdownExtensions }), ...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" }), + // CodeMirror disables native text assistance because it is primarily a code + // editor. Memos is a prose editor, so restore the browser behavior used by + // the textarea editor before v0.30. Autocorrect also keeps Windows TSF input + // out of Chrome's autocorrect-suppression path, which has dropped committed + // text from the emoji picker. + EditorView.contentAttributes.of({ + autocorrect: "on", + autocapitalize: "on", + spellcheck: "true", + }), placeholderCompartment.of(cmPlaceholder(placeholder)), EditorView.domEventHandlers({ paste: (event, view) => { diff --git a/web/tests/editor.test.tsx b/web/tests/editor.test.tsx index 3ad85295..0015fab4 100644 --- a/web/tests/editor.test.tsx +++ b/web/tests/editor.test.tsx @@ -105,7 +105,7 @@ describe("Editor", () => { expect(onChange).not.toHaveBeenCalledWith("server value"); }); - it("keeps native autocorrection enabled for Windows text services", () => { + it("enables native text assistance for prose input", () => { const props = { className: "x", initialContent: "", @@ -116,7 +116,10 @@ describe("Editor", () => { }; const { container } = render(); - expect(container.querySelector(".cm-content")).toHaveAttribute("autocorrect", "on"); + const content = container.querySelector(".cm-content"); + expect(content).toHaveAttribute("autocorrect", "on"); + expect(content).toHaveAttribute("autocapitalize", "on"); + expect(content).toHaveAttribute("spellcheck", "true"); }); it("reconfigures the placeholder when its translation changes", () => {