mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +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'),
|
||||
},
|
||||
automatchBraces: Setting.value('editor.autoMatchingBraces'),
|
||||
autocompleteMarkup: Setting.value('editor.autocompleteMarkup'),
|
||||
useExternalSearch: false,
|
||||
ignoreModifiers: true,
|
||||
spellcheckEnabled: Setting.value('editor.spellcheckBeta'),
|
||||
|
@ -345,6 +345,7 @@ function NoteEditor(props: Props, ref: any) {
|
||||
|
||||
automatchBraces: false,
|
||||
ignoreModifiers: false,
|
||||
autocompleteMarkup: Setting.value('editor.autocompleteMarkup'),
|
||||
|
||||
indentWithTabs: true,
|
||||
}), [props.themeId, props.readOnly]);
|
||||
|
@ -28,11 +28,21 @@ const configFromSettings = (settings: EditorSettings) => {
|
||||
settings.katexEnabled ? MarkdownMathExtension : [],
|
||||
],
|
||||
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) {
|
||||
return html();
|
||||
return html({ autoCloseTags: settings.autocompleteMarkup });
|
||||
} else {
|
||||
const exhaustivenessCheck: never = language;
|
||||
return exhaustivenessCheck;
|
||||
|
@ -7,7 +7,7 @@ import { classHighlighter } from '@lezer/highlight';
|
||||
import {
|
||||
EditorView, drawSelection, highlightSpecialChars, ViewUpdate, Command, rectangularSelection,
|
||||
} 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 { searchKeymap } from '@codemirror/search';
|
||||
@ -186,7 +186,13 @@ const createEditor = (
|
||||
notifyLinkEditRequest();
|
||||
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) => {
|
||||
// When at the beginning of the editor, allow shift-tab to act
|
||||
// normally.
|
||||
|
@ -10,6 +10,7 @@ const createEditorSettings = (themeId: number) => {
|
||||
readOnly: false,
|
||||
automatchBraces: false,
|
||||
ignoreModifiers: false,
|
||||
autocompleteMarkup: true,
|
||||
|
||||
keymap: EditorKeymap.Default,
|
||||
language: EditorLanguageType.Markdown,
|
||||
|
@ -152,6 +152,7 @@ export interface EditorSettings {
|
||||
useExternalSearch: boolean;
|
||||
|
||||
automatchBraces: boolean;
|
||||
autocompleteMarkup: boolean;
|
||||
|
||||
// True if internal command keyboard shortcuts should be ignored (thus
|
||||
// allowing Joplin shortcuts to run).
|
||||
|
@ -641,6 +641,18 @@ const builtInMetadata = (Setting: typeof SettingType) => {
|
||||
storage: SettingStorage.File,
|
||||
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': {
|
||||
value: defaultListColumns(),
|
||||
public: false,
|
||||
|
Loading…
Reference in New Issue
Block a user