createControl

public function createControl(name:String, controlman:tinymce.ControlManager):tinymce.ui.Control
Gets called when a new control instance is created.

Examples

// Creates a new plugin class
tinymce.create('tinymce.plugins.ExamplePlugin', {
    createControl: function(n, cm) {
        switch (n) {
            case 'mylistbox':
                var mlb = cm.createListBox('mylistbox', {
                     title : 'My list box',
                     onselect : function(v) {
                         tinyMCE.activeEditor.windowManager.alert('Value selected:' + v);
                     }
                });

                // Add some values to the list box
                mlb.add('Some item 1', 'val1');
                mlb.add('some item 2', 'val2');
                mlb.add('some item 3', 'val3');

                // Return the new listbox instance
                return mlb;
        }

        return null;
    }
});

// Register plugin
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 : 'mylistbox' // Add the new mylistbox control to the toolbar
});

Params

Name Type Description
name String Control name to create for example "mylistbox"
controlman tinymce.ControlManager Control manager/factory to use to create the control.

Returns

tinymce.ui.Control Returns a new control instance or null.