Learn how you can easily retrieve the current version that you are using on TinyMCE with plain JavaScript

TinyMCE is without a doubt one of the best WYSIWYG editor components that you can easily embed on your web applications.

Although it may seem just like an useless thing to learn, there's still developers that work on features of projects that may seem a little bit obsolete, for example the possibility to simply upload a zip with the content of a plugin or something like that. In this case, instead of manually reading the version of the plugin in the readme file, you may automatize this with JavaScript by simply obtaining the version from the TinyMCE itself.

If you check on the source code of TinyMCE in the official repository at Github, specifically on this file, you will find 2 properties on the definition of the TinyMCE object:

  • majorVersion: contains the Major version of TinyMCE build.
  • minorVersion: contains the Minor version of TinyMCE build.

Knowing this, you may simply obtain the full version by concatenating the values like this:

// Prints 5.4.1 or your current version
console.log(tinymce.majorVersion + '.' + tinymce.minorVersion);

Happy coding ❤️!

Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.