1 function getContentToInsert({html, markdown}) {
2 return markdown || html;
6 * @param {MarkdownEditor} editor
8 export function listen(editor) {
9 window.$events.listen('editor::replace', eventContent => {
10 const markdown = getContentToInsert(eventContent);
11 editor.actions.replaceContent(markdown);
14 window.$events.listen('editor::append', eventContent => {
15 const markdown = getContentToInsert(eventContent);
16 editor.actions.appendContent(markdown);
19 window.$events.listen('editor::prepend', eventContent => {
20 const markdown = getContentToInsert(eventContent);
21 editor.actions.prependContent(markdown);
24 window.$events.listen('editor::insert', eventContent => {
25 const markdown = getContentToInsert(eventContent);
26 editor.actions.insertContent(markdown);
29 window.$events.listen('editor::focus', () => {
30 editor.actions.focus();