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';
9 * Initiate a new markdown editor instance.
10 * @param {MarkdownEditorConfig} config
11 * @returns {Promise<MarkdownEditor>}
13 export async function init(config) {
15 * @type {MarkdownEditor}
19 markdown: new Markdown(),
20 settings: new Settings(config.settingInputs),
23 editor.actions = new Actions(editor);
24 editor.display = new Display(editor);
25 editor.cm = await initCodemirror(editor);
33 * @typedef MarkdownEditorConfig
34 * @property {String} pageId
35 * @property {Element} container
36 * @property {Element} displayEl
37 * @property {HTMLTextAreaElement} inputEl
38 * @property {String} drawioUrl
39 * @property {HTMLInputElement[]} settingInputs
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 {EditorView} cm
50 * @property {Settings} settings