mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-11 14:09:55 +02:00
Desktop,Mobile: Add setting to disable markup autocompletion (#11222)
This commit is contained in:
parent
d7f4f5f2b8
commit
92c13c2991
@ -381,6 +381,7 @@ const CodeMirror = (props: NoteBodyEditorProps, ref: ForwardedRef<NoteBodyEditor
|
|||||||
monospaceFont: Setting.value('style.editor.monospaceFontFamily'),
|
monospaceFont: Setting.value('style.editor.monospaceFontFamily'),
|
||||||
},
|
},
|
||||||
automatchBraces: Setting.value('editor.autoMatchingBraces'),
|
automatchBraces: Setting.value('editor.autoMatchingBraces'),
|
||||||
|
autocompleteMarkup: Setting.value('editor.autocompleteMarkup'),
|
||||||
useExternalSearch: false,
|
useExternalSearch: false,
|
||||||
ignoreModifiers: true,
|
ignoreModifiers: true,
|
||||||
spellcheckEnabled: Setting.value('editor.spellcheckBeta'),
|
spellcheckEnabled: Setting.value('editor.spellcheckBeta'),
|
||||||
|
@ -345,6 +345,7 @@ function NoteEditor(props: Props, ref: any) {
|
|||||||
|
|
||||||
automatchBraces: false,
|
automatchBraces: false,
|
||||||
ignoreModifiers: false,
|
ignoreModifiers: false,
|
||||||
|
autocompleteMarkup: Setting.value('editor.autocompleteMarkup'),
|
||||||
|
|
||||||
indentWithTabs: true,
|
indentWithTabs: true,
|
||||||
}), [props.themeId, props.readOnly]);
|
}), [props.themeId, props.readOnly]);
|
||||||
|
@ -28,11 +28,21 @@ const configFromSettings = (settings: EditorSettings) => {
|
|||||||
settings.katexEnabled ? MarkdownMathExtension : [],
|
settings.katexEnabled ? MarkdownMathExtension : [],
|
||||||
],
|
],
|
||||||
codeLanguages: lookUpLanguage,
|
codeLanguages: lookUpLanguage,
|
||||||
|
|
||||||
|
...(settings.autocompleteMarkup ? {
|
||||||
|
// Most Markup completion is enabled by default
|
||||||
|
} : {
|
||||||
|
addKeymap: false,
|
||||||
|
completeHTMLTags: false,
|
||||||
|
htmlTagLanguage: html({ matchClosingTags: false, autoCloseTags: false }),
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
markdownLanguage.data.of({
|
||||||
|
closeBrackets: openingBrackets,
|
||||||
}),
|
}),
|
||||||
markdownLanguage.data.of({ closeBrackets: openingBrackets }),
|
|
||||||
];
|
];
|
||||||
} else if (language === EditorLanguageType.Html) {
|
} else if (language === EditorLanguageType.Html) {
|
||||||
return html();
|
return html({ autoCloseTags: settings.autocompleteMarkup });
|
||||||
} else {
|
} else {
|
||||||
const exhaustivenessCheck: never = language;
|
const exhaustivenessCheck: never = language;
|
||||||
return exhaustivenessCheck;
|
return exhaustivenessCheck;
|
||||||
|
@ -7,7 +7,7 @@ import { classHighlighter } from '@lezer/highlight';
|
|||||||
import {
|
import {
|
||||||
EditorView, drawSelection, highlightSpecialChars, ViewUpdate, Command, rectangularSelection,
|
EditorView, drawSelection, highlightSpecialChars, ViewUpdate, Command, rectangularSelection,
|
||||||
} from '@codemirror/view';
|
} from '@codemirror/view';
|
||||||
import { history, undoDepth, redoDepth, standardKeymap } from '@codemirror/commands';
|
import { history, undoDepth, redoDepth, standardKeymap, insertTab } from '@codemirror/commands';
|
||||||
|
|
||||||
import { keymap, KeyBinding } from '@codemirror/view';
|
import { keymap, KeyBinding } from '@codemirror/view';
|
||||||
import { searchKeymap } from '@codemirror/search';
|
import { searchKeymap } from '@codemirror/search';
|
||||||
@ -186,7 +186,13 @@ const createEditor = (
|
|||||||
notifyLinkEditRequest();
|
notifyLinkEditRequest();
|
||||||
return true;
|
return true;
|
||||||
}),
|
}),
|
||||||
keyCommand('Tab', insertOrIncreaseIndent, true),
|
keyCommand('Tab', (view: EditorView) => {
|
||||||
|
if (settings.autocompleteMarkup) {
|
||||||
|
return insertOrIncreaseIndent(view);
|
||||||
|
}
|
||||||
|
// Use the default indent behavior (which doesn't adjust markup)
|
||||||
|
return insertTab(view);
|
||||||
|
}, true),
|
||||||
keyCommand('Shift-Tab', (view) => {
|
keyCommand('Shift-Tab', (view) => {
|
||||||
// When at the beginning of the editor, allow shift-tab to act
|
// When at the beginning of the editor, allow shift-tab to act
|
||||||
// normally.
|
// normally.
|
||||||
|
@ -10,6 +10,7 @@ const createEditorSettings = (themeId: number) => {
|
|||||||
readOnly: false,
|
readOnly: false,
|
||||||
automatchBraces: false,
|
automatchBraces: false,
|
||||||
ignoreModifiers: false,
|
ignoreModifiers: false,
|
||||||
|
autocompleteMarkup: true,
|
||||||
|
|
||||||
keymap: EditorKeymap.Default,
|
keymap: EditorKeymap.Default,
|
||||||
language: EditorLanguageType.Markdown,
|
language: EditorLanguageType.Markdown,
|
||||||
|
@ -152,6 +152,7 @@ export interface EditorSettings {
|
|||||||
useExternalSearch: boolean;
|
useExternalSearch: boolean;
|
||||||
|
|
||||||
automatchBraces: boolean;
|
automatchBraces: boolean;
|
||||||
|
autocompleteMarkup: boolean;
|
||||||
|
|
||||||
// True if internal command keyboard shortcuts should be ignored (thus
|
// True if internal command keyboard shortcuts should be ignored (thus
|
||||||
// allowing Joplin shortcuts to run).
|
// allowing Joplin shortcuts to run).
|
||||||
|
@ -641,6 +641,18 @@ const builtInMetadata = (Setting: typeof SettingType) => {
|
|||||||
storage: SettingStorage.File,
|
storage: SettingStorage.File,
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
},
|
},
|
||||||
|
'editor.autocompleteMarkup': {
|
||||||
|
value: true,
|
||||||
|
advanced: true,
|
||||||
|
type: SettingItemType.Bool,
|
||||||
|
public: true,
|
||||||
|
section: 'note',
|
||||||
|
appTypes: [AppType.Desktop, AppType.Mobile],
|
||||||
|
label: () => _('Autocomplete Markdown and HTML'),
|
||||||
|
description: () => _('Enables Markdown list continuation, auto-closing HTML tags, and other markup autocompletions.'),
|
||||||
|
storage: SettingStorage.File,
|
||||||
|
isGlobal: true,
|
||||||
|
},
|
||||||
'notes.columns': {
|
'notes.columns': {
|
||||||
value: defaultListColumns(),
|
value: defaultListColumns(),
|
||||||
public: false,
|
public: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user