From ea30a6bd388c398d5a0899e44c2f759b941f0045 Mon Sep 17 00:00:00 2001 From: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com> Date: Fri, 30 Dec 2022 15:20:56 -0800 Subject: [PATCH] Mobile: Fixes #6175: Enable autocorrect with spellcheck (#7532) --- .../components/NoteEditor/CodeMirror/CodeMirror.ts | 1 + .../NoteEditor/CodeMirror/decoratorExtension.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/app-mobile/components/NoteEditor/CodeMirror/CodeMirror.ts b/packages/app-mobile/components/NoteEditor/CodeMirror/CodeMirror.ts index 31007f3e3f..39993349ba 100644 --- a/packages/app-mobile/components/NoteEditor/CodeMirror/CodeMirror.ts +++ b/packages/app-mobile/components/NoteEditor/CodeMirror/CodeMirror.ts @@ -309,6 +309,7 @@ export function initCodeMirror( EditorView.lineWrapping, EditorView.contentAttributes.of({ autocapitalize: 'sentence', + autocorrect: settings.spellcheckEnabled ? 'true' : 'false', spellcheck: settings.spellcheckEnabled ? 'true' : 'false', }), EditorView.updateListener.of((viewUpdate: ViewUpdate) => { diff --git a/packages/app-mobile/components/NoteEditor/CodeMirror/decoratorExtension.ts b/packages/app-mobile/components/NoteEditor/CodeMirror/decoratorExtension.ts index 43aa9f0537..c37c7ed845 100644 --- a/packages/app-mobile/components/NoteEditor/CodeMirror/decoratorExtension.ts +++ b/packages/app-mobile/components/NoteEditor/CodeMirror/decoratorExtension.ts @@ -18,24 +18,26 @@ const regionStopDecoration = Decoration.line({ attributes: { class: 'cm-regionLastLine' }, }); +const noSpellCheckAttrs = { spellcheck: 'false', autocorrect: 'false' }; + const codeBlockDecoration = Decoration.line({ - attributes: { class: 'cm-codeBlock', spellcheck: 'false' }, + attributes: { class: 'cm-codeBlock', ...noSpellCheckAttrs }, }); const inlineCodeDecoration = Decoration.mark({ - attributes: { class: 'cm-inlineCode', spellcheck: 'false' }, + attributes: { class: 'cm-inlineCode', ...noSpellCheckAttrs }, }); const mathBlockDecoration = Decoration.line({ - attributes: { class: 'cm-mathBlock', spellcheck: 'false' }, + attributes: { class: 'cm-mathBlock', ...noSpellCheckAttrs }, }); const inlineMathDecoration = Decoration.mark({ - attributes: { class: 'cm-inlineMath', spellcheck: 'false' }, + attributes: { class: 'cm-inlineMath', ...noSpellCheckAttrs }, }); const urlDecoration = Decoration.mark({ - attributes: { class: 'cm-url', spellcheck: 'false' }, + attributes: { class: 'cm-url', ...noSpellCheckAttrs }, }); const blockQuoteDecoration = Decoration.line({