mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-06 22:46:29 +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.lineWrapping,
|
||||||
EditorView.contentAttributes.of({
|
EditorView.contentAttributes.of({
|
||||||
autocapitalize: 'sentence',
|
autocapitalize: 'sentence',
|
||||||
spellcheck: 'true',
|
spellcheck: settings.spellcheckEnabled ? 'true' : 'false',
|
||||||
}),
|
}),
|
||||||
EditorView.updateListener.of((viewUpdate: ViewUpdate) => {
|
EditorView.updateListener.of((viewUpdate: ViewUpdate) => {
|
||||||
notifyDocChanged(viewUpdate);
|
notifyDocChanged(viewUpdate);
|
||||||
@ -384,10 +384,6 @@ export function initCodeMirror(
|
|||||||
closeSearchPanel(editor);
|
closeSearchPanel(editor);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setSpellcheckEnabled: (enabled: boolean) => {
|
|
||||||
editor.contentDOM.spellcheck = enabled;
|
|
||||||
notifySelectionFormattingChange();
|
|
||||||
},
|
|
||||||
|
|
||||||
// Formatting
|
// Formatting
|
||||||
toggleBolded: () => { toggleBolded(editor); },
|
toggleBolded: () => { toggleBolded(editor); },
|
||||||
|
@ -7,8 +7,6 @@ export interface CodeMirrorControl {
|
|||||||
select(anchor: number, head: number): void;
|
select(anchor: number, head: number): void;
|
||||||
insertText(text: string): void;
|
insertText(text: string): void;
|
||||||
|
|
||||||
setSpellcheckEnabled(enabled: boolean): void;
|
|
||||||
|
|
||||||
// Toggle whether we're in a type of region.
|
// Toggle whether we're in a type of region.
|
||||||
toggleBolded(): void;
|
toggleBolded(): void;
|
||||||
toggleItalicized(): void;
|
toggleItalicized(): void;
|
||||||
|
@ -117,7 +117,8 @@ function NoteEditor(props: Props, ref: any) {
|
|||||||
const editorSettings: EditorSettings = {
|
const editorSettings: EditorSettings = {
|
||||||
themeId: props.themeId,
|
themeId: props.themeId,
|
||||||
themeData: editorTheme(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 = `
|
const injectedJavaScript = `
|
||||||
@ -247,9 +248,6 @@ function NoteEditor(props: Props, ref: any) {
|
|||||||
hideKeyboard() {
|
hideKeyboard() {
|
||||||
injectJS('document.activeElement?.blur();');
|
injectJS('document.activeElement?.blur();');
|
||||||
},
|
},
|
||||||
setSpellcheckEnabled(enabled: boolean) {
|
|
||||||
injectJS(`cm.setSpellcheckEnabled(${enabled ? 'true' : 'false'});`);
|
|
||||||
},
|
|
||||||
searchControl: {
|
searchControl: {
|
||||||
findNext() {
|
findNext() {
|
||||||
injectJS('cm.searchControl.findNext();');
|
injectJS('cm.searchControl.findNext();');
|
||||||
|
@ -18,6 +18,7 @@ export interface EditorSettings {
|
|||||||
themeData: Theme;
|
themeData: Theme;
|
||||||
|
|
||||||
katexEnabled: boolean;
|
katexEnabled: boolean;
|
||||||
|
spellcheckEnabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChangeEvent {
|
export interface ChangeEvent {
|
||||||
|
@ -1026,6 +1026,19 @@ class Setting extends BaseModel {
|
|||||||
isGlobal: true,
|
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: {
|
newTodoFocus: {
|
||||||
value: 'title',
|
value: 'title',
|
||||||
type: SettingItemType.String,
|
type: SettingItemType.String,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user