fix(editor): restore Windows emoji input
This commit is contained in:
parent
2036c1ffc1
commit
b4fefa94d7
2 changed files with 20 additions and 0 deletions
|
|
@ -80,6 +80,12 @@ export function buildEditorExtensions({
|
||||||
markdown({ extensions: [GFM] }),
|
markdown({ extensions: [GFM] }),
|
||||||
...memoEditorTheme,
|
...memoEditorTheme,
|
||||||
EditorView.lineWrapping,
|
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)),
|
placeholderCompartment.of(cmPlaceholder(placeholder)),
|
||||||
EditorView.domEventHandlers({
|
EditorView.domEventHandlers({
|
||||||
paste: (event) => {
|
paste: (event) => {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,20 @@ describe("Editor", () => {
|
||||||
expect(onChange).toHaveBeenCalledWith("hello");
|
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", () => {
|
it("reconfigures the placeholder when its translation changes", () => {
|
||||||
const props = {
|
const props = {
|
||||||
className: "x",
|
className: "x",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue