addJSPlugin

Availability: >= 3.0

Type: Object Method

Description: Tells the editor to load a JavaScript API plugin.

Syntax:

$editor->addJSPluginstr $pluginName [, string $filename] );

When the editor is displayed in the browser it will load the specified plugin. 

Parameters:

$pluginName
The name of the plugin to load.

$filename (optional)
If you specify a filename then WysiwygPro will load that file using a script tag. The file must exist within a plugin folder that has the same name as the plugin. Loading the plugin file is optional because the code for the plugin could have been added already using a script tag.

Example: 

Loading a plugin using a file:

$editor->addJSPlugin'myPlugin''plugin.js' );

plugin.js would need to be located here:

wysiwygPro/plugins/myPlugin/plugin.js

Example 2, loading a plugin without creating a script file:

// Output the code for the plugin rather than placing it in an external file
$editor->addOutputAbove('
function wproPlugin_myPlugin (editor) {
    editor.addEditorEvent('load', function (editor) {
        alert('load event called');
    });
}
'
);

// load the plugin
$editor->addJSPlugin'myPlugin' );