Question

Does TinyMCE's API support a method for finding whether or not a plugin is active, or better, whether a given command is registered? Specifically, I am creating a plugin that would like to call the mceAutoResize command at periods, but in order to do so I would prefer to detect whether the command exists or not. I know I can do this by searching the plugins parameter, but I wanted to know specifically if there is an API-supported way (to limit the chances that this plugin will break on a TinyMCE update).

Was it helpful?

Solution

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

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

To check if a given command (in this case mceAutoResize) is available you may use

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

It is not likely that this will ever change in tinymce.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top