mirror of https://github.com/laurent22/joplin.git
Desktop: Rich Text Editor: Add setting to allow disabling auto-format (#12022)
parent
f6d69ef702
commit
5bcb2531f4
|
@ -738,6 +738,24 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
|||
code: { inline: 'code', remove: 'all', attributes: { spellcheck: 'false' } },
|
||||
forecolor: { inline: 'span', styles: { color: '%value' } },
|
||||
},
|
||||
text_patterns: props.enableTextPatterns ? [
|
||||
// See https://www.tiny.cloud/docs/tinymce/latest/content-behavior-options/#text_patterns
|
||||
// for the default value
|
||||
{ start: '==', end: '==', format: 'joplinHighlight' },
|
||||
{ start: '`', end: '`', format: 'code' },
|
||||
{ start: '*', end: '*', format: 'italic' },
|
||||
{ start: '**', end: '**', format: 'bold' },
|
||||
{ start: '#', format: 'h1' },
|
||||
{ start: '##', format: 'h2' },
|
||||
{ start: '###', format: 'h3' },
|
||||
{ start: '####', format: 'h4' },
|
||||
{ start: '#####', format: 'h5' },
|
||||
{ start: '######', format: 'h6' },
|
||||
{ start: '1.', cmd: 'InsertOrderedList' },
|
||||
{ start: '*', cmd: 'InsertUnorderedList' },
|
||||
{ start: '-', cmd: 'InsertUnorderedList' },
|
||||
] : [],
|
||||
|
||||
setup: (editor: Editor) => {
|
||||
editor.addCommand('joplinAttach', () => {
|
||||
insertResourcesIntoContentRef.current();
|
||||
|
|
|
@ -451,6 +451,7 @@ function NoteEditorContent(props: NoteEditorProps) {
|
|||
searchMarkers: searchMarkers,
|
||||
visiblePanes: props.noteVisiblePanes || ['editor', 'viewer'],
|
||||
keyboardMode: Setting.value('editor.keyboardMode'),
|
||||
enableTextPatterns: Setting.value('editor.enableTextPatterns'),
|
||||
tabMovesFocus: props.tabMovesFocus,
|
||||
locale: Setting.value('locale'),
|
||||
onDrop: onDrop,
|
||||
|
|
|
@ -124,6 +124,7 @@ export interface NoteBodyEditorProps {
|
|||
visiblePanes: string[];
|
||||
keyboardMode: string;
|
||||
tabMovesFocus: boolean;
|
||||
enableTextPatterns: boolean;
|
||||
resourceInfos: ResourceInfos;
|
||||
resourceDirectory: string;
|
||||
locale: string;
|
||||
|
|
|
@ -684,6 +684,17 @@ const builtInMetadata = (Setting: typeof SettingType) => {
|
|||
storage: SettingStorage.File,
|
||||
isGlobal: true,
|
||||
},
|
||||
'editor.enableTextPatterns': {
|
||||
value: true,
|
||||
type: SettingItemType.Bool,
|
||||
public: true,
|
||||
section: 'note',
|
||||
appTypes: [AppType.Desktop],
|
||||
label: () => _('Auto-format Markdown in the Rich Text Editor'),
|
||||
description: () => _('Enables Markdown pattern replacement in the Rich Text Editor. For example, when enabled, typing **bold** creates bold text.'),
|
||||
storage: SettingStorage.File,
|
||||
isGlobal: true,
|
||||
},
|
||||
'editor.toolbarButtons': {
|
||||
value: [] as string[],
|
||||
public: false,
|
||||
|
|
Loading…
Reference in New Issue