Reputation: 12281
Does anyone know how to disable TinyMCE alerts, and confirms. The confirm in talking about says:
This page is asking you to confirm that you want to leave - data you have entered may not be saved Leave Page - Stay on Page
I've written my own stuff that detects if the page data has been change so I don;t want TinyMCE to worry. I found the function in the TinyMCE source so I'm about to overwrite it but I want to know if anyone knows a better way to accomplish this. Thanks.
Upvotes: 12
Views: 14139
Reputation: 12281
As per a request I'm adding this here to show my solution which has worked great:
My solution thanks to a link provided by Madmartigan, on the TinyMCE forum. Getting rid of the autosave plugin did not work, I ended up writing this:
window.onbeforeunload = function() {};
And it got rid of the popup. Looks like it could be a bug with TinyMCE, since the init code I have I copied off their demo.
Upvotes: 9
Reputation: 9604
If the problem you're having is just that the content isn't actually dirty, maybe because you replaced it programmatically, you can explicitly mark the editor as not dirty like this:
tinyMCE.activeEditor.isNotDirty = true
Upvotes: 5
Reputation: 1779
I set it as a param when initializing (autosave_ask_before_unload):
tinymce.init({
mode: 'textareas',
menubar: false,
statusbar: false,
language: 'sv_SE',
autosave_ask_before_unload: false,
...
Upvotes: 9
Reputation: 101
Neither of the above answers worked for me with Joomla 3.3.2 and JCE 2.5.11. Although this did work: Inside the file -
components/com_jce/editor/tiny_mce/plugins/autosave/editor_plugin.js,
I changed
editor.getParam("autosave_ask_before_unload",TRUE)
to
editor.getParam("autosave_ask_before_unload",FALSE)
Apparently on autosave unload, it prompts the confirm box. This disables the unload confirm completely. From what I tested, it worked in IE, Chrome, and FF.
Upvotes: 1
Reputation: 102745
To remove the message, just disable the autosave
plugin, that's what adds the onunload
prompt.
Simply don't load the plugin in your TinyMCE initialization script.
Upvotes: 17