X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ad48cd3e48ab5b16932d8c38032b80af619f525f..refs/pull/2283/head:/resources/js/components/markdown-editor.js diff --git a/resources/js/components/markdown-editor.js b/resources/js/components/markdown-editor.js index 5ffe4ef4d..c371a9839 100644 --- a/resources/js/components/markdown-editor.js +++ b/resources/js/components/markdown-editor.js @@ -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();