user6824563 user6824563 - 23 days ago 9
jQuery Question

Get TinyMCE Print event

How can I get the tinyMCE print button event?

I want to do something after clicking on print.
For exxample:

if(editor.print() == 'Finish'){ alert('Test'); }


Does anyone know if it is possible?

Answer

You could register for the ExecCommand event.

tinymce.init({
  selector: 'textarea',
  plugins: 'print',
  init_instance_callback: function (editor) {
    editor.on('ExecCommand', function (e) {
      if (e.command === 'mcePrint') {
        alert('Print');
      }
    });
  }
});