Detect a focus on wp_editor

You can pass an array of settings to the editor instance.
For possible values please refer to the tinymce documentation, in your case ‘init_instance_callback’ might be helpful.

https://www.tinymce.com/docs/configure/integration-and-setup/#init_instance_callback

  wp_editor('', 'sedemoeditor', array(
        'tinymce' => array(
            'init_instance_callback' => 'function(editor) {
                        editor.on("focus", function(){
                            console.log("Editor: " + editor.id + " focus.");
                    });
                }'
            )
));

Leave a Comment