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