Search code examples
javascripttinymcetinymce-plugins

How can we check whether the TinyMCE editor is initialised on our webpage using Javascript?


I need to integrate a plugin to TinyMCE editor. For that purpose, I need to check whether TinyMCE editor is present in any of the pages. If we able to check it using Javascript, it will be good. Only if I succeed in this step, I can go forward. Please help me to find a solution as early as possible.


Solution

  • you can simply test for the tinyMCE global var, that is created by tinyMCE script.

    It seems to be available before the ready, as long as you are after the script declaration. In case you fear the script to be placed at the bottom of the page, use the ready event.

    console.log('tinyMCE exists? ' + (tinyMCE === undefined ? 'NO' : 'YES'));