Important changes to Tiny Cloud pricing > Find out more

NOTE: TinyMCE 5 reached End of Support in April 2023. No more bug fixes, security updates, or new features will be introduced to TinyMCE 5. We recommend you upgrade to TinyMCE 6 or consider TinyMCE 5 Long Term Support (LTS) if you need more time.

tinymce.Plugin

TinyMCE plugin psuedo class. Allows for custom plugins to be added to TinyMCE when registered using the PluginManager.

This is a pseudo class that describes how to create a custom plugin for TinyMCE.

A custom plugin registered using PluginManager.add should either not return any value or return plugin metadata as an object that contains the plugin's name and a URL. The URL is intended to link to help documentation.

See AddOnManager for more information about the methods available on the PluginManager instance.

Examples

tinymce.PluginManager.add('MyPlugin', function(editor, url) {
    // Register a toolbar button that triggers an alert when clicked
    // To show this button in the editor, include it in the toolbar setting
    editor.ui.registry.addButton('myCustomToolbarButton', {
        text: 'My Custom Button',
        onAction: function() {
            alert('Button clicked!');
        }
    });

    // Register a menu item that triggers an alert when clicked
    // To show this menu item in the editor, include it in the menu setting
    editor.ui.registry.addMenuItem('myCustomMenuItem', {
        text: 'My Custom Menu Item',
        onAction: function() {
            alert('Menu item clicked');
        }
    });

    // Either return plugin metadata or do not return
    return {
        name: 'MyPlugin',
        url: 'https://mydocs.com/myplugin'
    };
});

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.