TinyMCE:API/tinymce.Plugin

From Moxiecode Documentation Wiki

Jump to: navigation, search

Class: tinymce.Plugin

Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional.

Constructor

init
Initialized the specified plugin.
getInfo
Used to return plugin meta data such as author, version etc.
createControl
Implement this to create custom controls based on control names.

Examples

// Create a new plugin class
tinymce.create('tinymce.plugins.ExamplePlugin', {
    init : function(ed, url) {
        // Register an example button
        ed.addButton('example', {
            title : 'example.desc',
            onclick : function() {
                 // Display an alert when the user clicks the button
                 ed.windowManager.alert('Hello world!');
            },
            'class' : 'bold' // Use the bold icon from the theme
        });
    }
});

// Register plugin with a short name
tinymce.PluginManager.add('example', tinymce.plugins.ExamplePlugin);

// Initialize TinyMCE with the new plugin and button
tinyMCE.init({
   ...
   plugins : '-example', // - means TinyMCE will not try to load it
   theme_advanced_buttons1 : 'example' // Add the new example button to the toolbar
});
Personal tools