aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/comp/EditorUpload.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/features/comp/EditorUpload.ts')
-rw-r--r--web_src/js/features/comp/EditorUpload.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/web_src/js/features/comp/EditorUpload.ts b/web_src/js/features/comp/EditorUpload.ts
index 582639a817..b1f49cbe92 100644
--- a/web_src/js/features/comp/EditorUpload.ts
+++ b/web_src/js/features/comp/EditorUpload.ts
@@ -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) {