]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/markdown-editor.js
Checked over recycle bin parent/child flows
[bookstack] / resources / js / components / markdown-editor.js
index 5ffe4ef4d32b18d6e352831bd0fd3b10cb41ac77..c371a983991dfa333429b824122d0758628a4599 100644 (file)
@@ -563,6 +563,12 @@ class MarkdownEditor {
             this.cm.setCursor(cursorPos.line + prependLineCount, cursorPos.ch);
         });
 
+        // Insert editor content at the current location
+        window.$events.listen('editor::insert', (eventContent) => {
+            const markdown = getContentToInsert(eventContent);
+            this.cm.replaceSelection(markdown);
+        });
+
         // Focus on editor
         window.$events.listen('editor::focus', () => {
             this.cm.focus();