Problem Description
I am working on an advanced grading plugin and have added a button to the grading screen, that changes the content of the (atto) editor via .setHTML in js.
However, pressing the save button afterwards will not save any changes due to moodle not detecting that the content of the editor has been changed.
Is there a way to set the dirty flag on the editor in the grading screen, preferably with js?
Thanks.
My testing environment uses Moodle 4.1.1+.
```
var editor = Y.one('#id_assignfeedbackcomments_editor' + 'editable');
editor.setHTML(comment);
```
Edit: I did not get it to work with the atto editor. However, I am able to do it with TinyMCE now and since [russel england](https://stackoverflow.com/users/1603711/russell-england) pointed out that atto will be removed, I will let the client know that atto is depricated and keep it as a bug for now.
My code currently looks like this:
```
try {
tinyMCE.activeEditor.setContent(comment);
tinyMCE.activeEditor.setDirty(true);
} catch (error) {
Y.one('#id_assignfeedbackcomments_editoreditable').setHTML(comment);
}
```
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?