1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-03 22:37:35 +02:00

Mobile: Setting to disable spellcheck in beta editor (#6780)

This commit is contained in:
Henry Heino 2022-08-27 05:53:46 -07:00 committed by GitHub
parent 40e682faae
commit ae300de42f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 11 deletions

View File

@ -304,7 +304,7 @@ export function initCodeMirror(
EditorView.lineWrapping,
EditorView.contentAttributes.of({
autocapitalize: 'sentence',
spellcheck: 'true',
spellcheck: settings.spellcheckEnabled ? 'true' : 'false',
}),
EditorView.updateListener.of((viewUpdate: ViewUpdate) => {
notifyDocChanged(viewUpdate);
@ -384,10 +384,6 @@ export function initCodeMirror(
closeSearchPanel(editor);
}
},
setSpellcheckEnabled: (enabled: boolean) => {
editor.contentDOM.spellcheck = enabled;
notifySelectionFormattingChange();
},
// Formatting
toggleBolded: () => { toggleBolded(editor); },

View File

@ -7,8 +7,6 @@ export interface CodeMirrorControl {
select(anchor: number, head: number): void;
insertText(text: string): void;
setSpellcheckEnabled(enabled: boolean): void;
// Toggle whether we're in a type of region.
toggleBolded(): void;
toggleItalicized(): void;

View File

@ -117,7 +117,8 @@ function NoteEditor(props: Props, ref: any) {
const editorSettings: EditorSettings = {
themeId: props.themeId,
themeData: editorTheme(props.themeId),
katexEnabled: Setting.value('markdown.plugin.katex') as boolean,
katexEnabled: Setting.value('markdown.plugin.katex'),
spellcheckEnabled: Setting.value('editor.mobile.spellcheckEnabled'),
};
const injectedJavaScript = `
@ -247,9 +248,6 @@ function NoteEditor(props: Props, ref: any) {
hideKeyboard() {
injectJS('document.activeElement?.blur();');
},
setSpellcheckEnabled(enabled: boolean) {
injectJS(`cm.setSpellcheckEnabled(${enabled ? 'true' : 'false'});`);
},
searchControl: {
findNext() {
injectJS('cm.searchControl.findNext();');

View File

@ -18,6 +18,7 @@ export interface EditorSettings {
themeData: Theme;
katexEnabled: boolean;
spellcheckEnabled: boolean;
}
export interface ChangeEvent {

View File

@ -1026,6 +1026,19 @@ class Setting extends BaseModel {
isGlobal: true,
},
// Enables/disables spellcheck in the mobile markdown beta editor.
'editor.mobile.spellcheckEnabled': {
value: true,
type: SettingItemType.Bool,
section: 'note',
public: true,
appTypes: [AppType.Mobile],
show: (settings: any) => settings['editor.beta'],
label: () => _('Enable spellcheck in the beta editor'),
storage: SettingStorage.File,
isGlobal: true,
},
newTodoFocus: {
value: 'title',
type: SettingItemType.String,