2 * @param {Editor} editor
4 export function listen(editor) {
6 // Replace editor content
7 window.$events.listen('editor::replace', ({html}) => {
8 editor.setContent(html);
11 // Append editor content
12 window.$events.listen('editor::append', ({html}) => {
13 const content = editor.getContent() + html;
14 editor.setContent(content);
17 // Prepend editor content
18 window.$events.listen('editor::prepend', ({html}) => {
19 const content = html + editor.getContent();
20 editor.setContent(content);
23 // Insert editor content at the current location
24 window.$events.listen('editor::insert', ({html}) => {
25 editor.insertContent(html);
28 // Focus on the editor
29 window.$events.listen('editor::focus', () => {
30 if (editor.initialized) {