1 import {Markdown} from "./markdown";
2 import {Display} from "./display";
3 import {Actions} from "./actions";
4 import {Settings} from "./settings";
5 import {listen} from "./common-events";
6 import {init as initCodemirror} from "./codemirror";
10 * Initiate a new markdown editor instance.
11 * @param {MarkdownEditorConfig} config
12 * @returns {Promise<MarkdownEditor>}
14 export async function init(config) {
17 * @type {MarkdownEditor}
21 markdown: new Markdown(),
22 settings: new Settings(config.settings),
25 editor.actions = new Actions(editor);
26 editor.display = new Display(editor);
27 editor.cm = await initCodemirror(editor);
36 * @typedef MarkdownEditorConfig
37 * @property {String} pageId
38 * @property {Element} container
39 * @property {Element} displayEl
40 * @property {HTMLTextAreaElement} inputEl
41 * @property {String} drawioUrl
42 * @property {Object<String, String>} text
43 * @property {Object<String, any>} settings
47 * @typedef MarkdownEditor
48 * @property {MarkdownEditorConfig} config
49 * @property {Display} display
50 * @property {Markdown} markdown
51 * @property {Actions} actions
52 * @property {CodeMirror} cm
53 * @property {Settings} settings