Detect plugin or team existence in TinyMCE

Does the TinyMCE API support a method for determining whether a plugin is active or not, or better, is this command registered? In particular, I am creating a plugin that would like to call the mceAutoResize command in periods, but for this I would prefer to determine if the command exists or not. I know that I can do this by searching for the plugins parameter, but I would like to know specifically if there is a method supported by the API (to limit the likelihood that this plugin will be broken by the TinyMCE update).

+3
source share
1 answer

To find out if a plugin or command is active, there seems to be no real API functionality. What can you do to see if the plugin is loaded, use

var plugin_is_usable = tinymce.get(editor_id).plugins.pluginname;

To check if this command is available (in this case mceAutoResize), you can use

var mceAutoResize_is_usable = tinymce.get(editor_id).execCommands.mceAutoResize;

It doesn't look like this will ever change in tinymce.

+1
source

Source: https://habr.com/ru/post/1777997/


All Articles