jquery.AreYouSure icon indicating copy to clipboard operation
jquery.AreYouSure copied to clipboard

Tinymce support?

Open nikmauro opened this issue 11 years ago • 4 comments
trafficstars

The script not recognize changes from tinymce editor 4

nikmauro avatar Oct 05 '14 17:10 nikmauro

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.

codedance avatar Oct 23 '14 23:10 codedance

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);
        }

amitpatelx avatar Nov 10 '15 05:11 amitpatelx

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'); });

amitpatelx avatar Nov 17 '15 09:11 amitpatelx

Thank you for your post, @AmitPatel-BoTreeConsulting This really helped me! But tweaked the setupfunction 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.

mmichaa avatar Jan 21 '16 18:01 mmichaa