Forum Discussion

PerBonomi's avatar
7 years ago

Detect changes in the tinyMCE ActiveEditor

Does anyone know how to achieve this?

  • PerBonomi - Try below updated code.  You need to add an event on the active editor. 

    var ed = tinymce.activeEditor; 
    ed.on('change', function(e) {
             console.log('the event object ', e);
    console.log('the editor object ', ed);
    console.log('the content ', ed.getContent()); });

     

     

  • PerBonomi- Try below code.

    tinyMCE.init({
       setup:function(ed) {
           ed.on('change', function(e) {
               console.log('the event object ', e);
               console.log('the editor object ', ed);
               console.log('the content ', ed.getContent());
           });
       }
    });

     

    • PerBonomi's avatar
      PerBonomi
      Boss
      ​Thanks. Tried something along those lines, and this gets me the same
      result I see Promise pending, but nothing happens on edit.​
      • TariqHussain's avatar
        TariqHussain
        Boss

        PerBonomi - Try below updated code.  You need to add an event on the active editor. 

        var ed = tinymce.activeEditor; 
        ed.on('change', function(e) {
                 console.log('the event object ', e);
        console.log('the editor object ', ed);
        console.log('the content ', ed.getContent()); });