X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/da3ae3ba8b47800058f8613b2608a4084d64eb43..refs/pull/5625/head:/resources/js/components/markdown-editor.js diff --git a/resources/js/components/markdown-editor.js b/resources/js/components/markdown-editor.js index fa06807a5..ad5bcf090 100644 --- a/resources/js/components/markdown-editor.js +++ b/resources/js/components/markdown-editor.js @@ -1,5 +1,4 @@ import {Component} from './component'; -import {init as initEditor} from '../markdown/editor'; export class MarkdownEditor extends Component { @@ -20,17 +19,19 @@ export class MarkdownEditor extends Component { const settingInputs = settingContainer.querySelectorAll('input[type="checkbox"]'); this.editor = null; - initEditor({ - pageId: this.pageId, - container: this.elem, - displayEl: this.display, - inputEl: this.input, - drawioUrl: this.getDrawioUrl(), - settingInputs: Array.from(settingInputs), - text: { - serverUploadLimit: this.serverUploadLimitText, - imageUploadError: this.imageUploadErrorText, - }, + window.importVersioned('markdown').then(markdown => { + return markdown.init({ + pageId: this.pageId, + container: this.elem, + displayEl: this.display, + inputEl: this.input, + drawioUrl: this.getDrawioUrl(), + settingInputs: Array.from(settingInputs), + text: { + serverUploadLimit: this.serverUploadLimitText, + imageUploadError: this.imageUploadErrorText, + }, + }); }).then(editor => { this.editor = editor; this.setupListeners(); @@ -132,9 +133,9 @@ export class MarkdownEditor extends Component { /** * Get the content of this editor. * Used by the parent page editor component. - * @return {{html: String, markdown: String}} + * @return {Promise<{html: String, markdown: String}>} */ - getContent() { + async getContent() { return this.editor.actions.getContent(); }