Skip to content

Commit

Permalink
Fix incorrect init and change events on TinyMCE.
Browse files Browse the repository at this point in the history
- Moved the init event to init_instance_callback() from
@init event which doesn't fire.
- Add watcher for form.body to fire onEditorChange event. This
  fixes TinyMCE editor changes not getting saved.
  • Loading branch information
knadh committed Sep 23, 2021
1 parent a0addc7 commit ffcb987
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
v-if="form.format === 'richtext'"
:disabled="disabled"
:init="tinyMceOptions"
@init="() => isReady = true"
/>

<!-- raw html editor //-->
Expand Down Expand Up @@ -174,11 +173,13 @@ export default {
a { color: ${colors.primary}; }
table, td { border-color: #ccc;}
`,
file_picker_types: 'image',
file_picker_callback: (callback) => {
this.isMediaVisible = true;
this.runTinyMceImageCallback = callback;
},
init_instance_callback: () => { this.isReady = true; },
},
};
},
Expand Down Expand Up @@ -318,6 +319,11 @@ export default {
this.onEditorChange();
},
// eslint-disable-next-line func-names
'form.body': function () {
this.onEditorChange();
},
htmlFormat(to, from) {
// On switch to HTML, initialize the HTML editor.
if (to === 'html') {
Expand Down

0 comments on commit ffcb987

Please sign in to comment.