Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable TinyMCE confirm dialog

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.

like image 587
locrizak Avatar asked Apr 18 '11 16:04

locrizak


3 Answers

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,
        ...
like image 161
Jojje Avatar answered Sep 28 '22 15:09

Jojje


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.

like image 27
Wesley Murch Avatar answered Sep 28 '22 15:09

Wesley Murch


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.

like image 28
locrizak Avatar answered Sep 28 '22 15:09

locrizak