Open nikmauro opened 9 years ago
Hi Nikmauro, You may need to trigger are-you-sure to perform a manual check for change. Issue #17 and #62 provide some examples.
https://github.com/codedance/jquery.AreYouSure/issues/17 https://github.com/codedance/jquery.AreYouSure/issues/62
Hope this helps.
Here is how I configure tinyMCE but it doesn't work.
if (typeof tinyMCE != 'undefined') {
tinyMCE.init({
selector: "textarea.tinymce",
toolbar: ["bold italic | styleselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"],
plugins: "image,link,paste",
menubar: false,
invalid_elements: "div",
paste_data_images: true,
setup: function(ed) {
ed.on('change', function(e) { $('#post-form').trigger('checkform.areYouSure'); });
ed.on('keyup', function(e) { $('#post-form').trigger('checkform.areYouSure'); });
}
});
} else {
setTimeout(arguments.callee, 50);
}
I got a solution which might not optimal but works perfectly.
ed.on('change', function(e) { tinyMCE.triggerSave(); $('#post-form').trigger('checkform.areYouSure'); });
ed.on('keyup', function(e) { tinyMCE.triggerSave(); $('#post-form').trigger('checkform.areYouSure'); });
Thank you for your post, @AmitPatel-BoTreeConsulting This really helped me! But tweaked the setup
function a little bit (for my usecase):
function(editor) {
editor.on('dirty', function(event) {
editor.save();
$('.js-dirty-tracking').trigger('checkform.areYouSure');
});
}
For my usecase this works well. The benefit of using the dirty event ist, that it will be fired only once (at becoming dirty the first time). Maybe I should to say, that I'm using TinyMCE v4.
The script not recognize changes from tinymce editor 4