1 import {Markdown} from "./markdown";
2 import {Display} from "./display";
3 import {Actions} from "./actions";
4 import {listen} from "./common-events";
5 import {init as initCodemirror} from "./codemirror";
9 * Initiate a new markdown editor instance.
10 * @param {MarkdownEditorConfig} config
11 * @returns {Promise<MarkdownEditor>}
13 export async function init(config) {
16 * @type {MarkdownEditor}
20 markdown: new Markdown(),
23 editor.actions = new Actions(editor);
24 editor.display = new Display(editor);
25 editor.cm = await initCodemirror(editor);
34 * @typedef MarkdownEditorConfig
35 * @property {String} pageId
36 * @property {Element} container
37 * @property {Element} displayEl
38 * @property {HTMLTextAreaElement} inputEl
39 * @property {String} drawioUrl
40 * @property {Object<String, String>} text
44 * @typedef MarkdownEditor
45 * @property {MarkdownEditorConfig} config
46 * @property {Display} display
47 * @property {Markdown} markdown
48 * @property {Actions} actions
49 * @property {CodeMirror} cm