mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-29 22:13:57 +08:00
Add some handy markdown editor features (#32400)
There were some missing features from EasyMDE: 1. H1 - H3 style 2. Auto add task list 3. Insert a table And added some tests
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import {imageInfo} from '../../utils/image.ts';
|
||||
import {replaceTextareaSelection} from '../../utils/dom.ts';
|
||||
import {isUrl} from '../../utils/url.ts';
|
||||
import {triggerEditorContentChanged} from './EditorMarkdown.ts';
|
||||
import {textareaInsertText, triggerEditorContentChanged} from './EditorMarkdown.ts';
|
||||
import {
|
||||
DropzoneCustomEventRemovedFile,
|
||||
DropzoneCustomEventUploadDone,
|
||||
@ -41,14 +41,7 @@ class TextareaEditor {
|
||||
}
|
||||
|
||||
insertPlaceholder(value) {
|
||||
const editor = this.editor;
|
||||
const startPos = editor.selectionStart;
|
||||
const endPos = editor.selectionEnd;
|
||||
editor.value = editor.value.substring(0, startPos) + value + editor.value.substring(endPos);
|
||||
editor.selectionStart = startPos;
|
||||
editor.selectionEnd = startPos + value.length;
|
||||
editor.focus();
|
||||
triggerEditorContentChanged(editor);
|
||||
textareaInsertText(this.editor, value);
|
||||
}
|
||||
|
||||
replacePlaceholder(oldVal, newVal) {
|
||||
|
Reference in New Issue
Block a user