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:
parent
40e682faae
commit
ae300de42f
@ -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); },
|
||||
|
@ -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;
|
||||
|
@ -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();');
|
||||
|
@ -18,6 +18,7 @@ export interface EditorSettings {
|
||||
themeData: Theme;
|
||||
|
||||
katexEnabled: boolean;
|
||||
spellcheckEnabled: boolean;
|
||||
}
|
||||
|
||||
export interface ChangeEvent {
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user