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