diff --git a/app/javascript/views/answers/edit.js b/app/javascript/views/answers/edit.js index d6eefac..dbef31f 100644 --- a/app/javascript/views/answers/edit.js +++ b/app/javascript/views/answers/edit.js @@ -232,6 +232,10 @@ selector: `#${sectionId} .${editorClass}`, toolbar, }); + Tinymce.init({ + selector: `#${sectionId} .note`, + toolbar, + }); if (!isReadOnly()) { $(`#${sectionId} .${editorClass}`).each((i, editor) => { // Attaches form and tinymce event handlers @@ -252,5 +256,8 @@ detachEditorHandlers(Tinymce.findEditorById(`${$(editor).attr('id')}`)); Tinymce.destroyEditorById(`${$(editor).attr('id')}`); }); + $(`#${sectionId} .note`).each((i, editor) => { + Tinymce.destroyEditorById(`${$(editor).attr('id')}`); + }); }); }); diff --git a/app/javascript/views/notes/index.js b/app/javascript/views/notes/index.js index 0b28799..3eedfaf 100644 --- a/app/javascript/views/notes/index.js +++ b/app/javascript/views/notes/index.js @@ -162,8 +162,6 @@ const initOrReload = (researchOutputId = null) => { if (researchOutputId) { Tinymce.init({ selector: `${researchOutputId} .note` }); - } else { - Tinymce.init({ selector: '.note' }); } eventHandlers({ attachment: 'on' }); }; @@ -171,6 +169,7 @@ eventHandlers({ attachment: 'off' }); Tinymce.destroyEditorsByClassName('note'); }; + initOrReload(); initialiseCurrentViewSelector(); });