Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix(editor): restore Windows emoji input

johnnyjoyghb4fefa94d72c
diff --git a/web/src/components/MemoEditor/Editor/extensions.ts b/web/src/components/MemoEditor/Editor/extensions.ts
index 52a8a6421..167acb5b7 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 47f44cde4..96b53d8c5 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(<Editor {...props} />);
+
+ expect(container.querySelector(".cm-content")).toHaveAttribute("autocorrect", "on");
+ });
+
it("reconfigures the placeholder when its translation changes", () => {
const props = {
className: "x",