2

I've programmed a modal with a TinyMCE editor inside, where it's value is saved via ajax, but when leaving the page there's still the warning Changes you made may not be saved.

Is there a function or some sort of flag I can configure to avoid the alert?

1 Answer 1

1

The popup is caused by a bound onbeforeunload event that is being added via the autosave plugin. To completely disable it;

var editor = window.Joomla.editors.instances['{editor}'];
editor.instance.plugins.autosave = {};

Replace {editor} with the id of the editor.

Addendum (2022-09-15): This code now throws an error during the onbeforeunload event. I've found a fix already:

var editor = window.Joomla.editors.instances['{editor}'];
editor.instance.plugins.autosave = {storeDraft:function(){editor.instance.setDirty(false)}};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.