Home Forums ACF PRO insert values into fields programmatically Reply To: insert values into fields programmatically

  • Adding actions to tinyMCE editors.

    I kept digging and I figured out how to add actions to the editors. This needs to be done only after the editor is added with the new “delay initialization” feature of wysiwyg fields.

      tinyMCE.on('addEditor', function(e) {
        // fires every time an editor is initialized
        if (typeof(e.editor) == 'undefined' || !^acf-editor-/)) {
          // not an acf wysiwyg field
        console.log(e.editor); // the editor
        console.log(; // the editor id
        e.editor.on('input', function(ed) {
          // fires on any input to this editor
          // could also use change, blur, focus, etc...
          // you'd want to check the editor ID to match it
          // to only the one you want to add this action to
      }); // end tinyMCE.on
    }); // end jQuery(document).ready