EditLive! 9 Documentation : plugin

This element defines the information required to load a single plugin. 

Plug-in Element Tree Structure

<plugin>

<plugin>
   <!-- configuration settings -->
</plugin>

Child Elements

<advancedapis (Applet)>

This element defines what Java classes the plugin will load.

<menu>

The menu element defines the menu items which will appear under the Plugins menu in EditLive!.

<script>

Additional Javascript files can be applied to the webpage loading EditLive! by using this element.

Optional Attributes

load

This attribute defines how java classes (defined in <advancedapis (Applet)>) and Javascript files (defined in <script>) are loaded by EditLive!:

  • immediate- EditLive! will not load until each specified java class/classes and/or Javascript file has been cached and is ready for use by the editor.
    • Example: Your plugin creates custom rendering for custom HTML tags appearing in your content. Because these tags may appear in the default content for EditLive!, the plugin is required as soon as the editor loads. To ensure this plugin code is instantly available to EditLive!, use the immediate load attribute.
  • background- EditLive! will load as normal, caching the required java class/classes in the background.
    • Example: Your plugin may be designed to launch a complex dialog for restructuring the current HTML stored in EditLive!. Due to its complexity, the plugin size is quite large and hence will take a significant amount of time to cache and load into EditLive!. It would be undesirable to use immediate because this would substantially increase the load time for EditLive!. background can be used to ensure the editor loads as normal, providing the plugin functionality to the user a short time after the editor has loaded.
  • lazy- These java classes will not be cached and utilized by the editor until the user selects a menu item from the Plugins menu that requires these java classes.
    • Example: Your plugin defines a menu item that, once selected, inserts a HTML fragment into EditLive!. The plugin size is quite small, meaning it will not take long to both cache and load. The lazyload value could be used to only load the plugin when the user tries to utilize this functionality.

      Only use lazy when implementing java classes you want loaded when the user selects a specified menu item. If you want the functionality found in your specified java classes or Javascript files available immediately, use immediate.

Default Value: immediate

url

This attribute is used when a plugin is loaded into the editor via the <Plugins> Configuration File element.

The url attribute is used to specify the location of an external XML file that specifies the details of an EditLive! plugin.

Example
The following file myPlugin.xml sits on a server at the URL http://mysever/mypluginsdir/myPlugin.xml

<?xml version="1.0" encoding="US-ASCII" ?> 
<plugin load="immediate">
       <advancedapis jar="myPlugin.jar" class="MyPlugin" />
       <menu>
                  <customMenuItem name="plugin" action="raiseEvent" value="displayDialog" text="Display Dialog" imageURL="images/small_logo.gif"/> 
       </menu>
</plugin>

This plugin can be loaded using a <plugin> element, with a url attribute, nested in the Configuration File's <Plugins> element:

<editLive>
 
     ...
 
     <plugins>
 
        <plugin url="http://mysever/mypluginsdir/myPlugin.xml" />        
 
     </plugins>
 
     ...
 
</editLive>
name

EditLive! comes packaged with several plugins. These plugins can be initialized by simply specifying a name attribute on a plugin element resident in an EditLive! configuration file.

EditLive! for Java accepts the following plugin name attributes:

  • imageEditor - enables the Image Editor functionality.
  • tableToolbar - allows developers to specify an <inlineToolbar> to appear for TABLE elements.
  • accessibility - enables the Accessibility As You Type functionality.
  • BrokenHyperlinkReport - enables the Broken Hyperlink Report functionality.
  • autosave - enables the Autosave functionality.
  • rtfpaste - provides the ability to import .rtf when using Apple OSX. The RTF clipboard flavor on OSX will be supported, allowing copy and paste of rich content from sources such as Safari.
  • spelling¬†- enables the Spell Check functionality.

Example
The following configuration file excerpt will load the image editor and the inline table toolbar functionality into an instance of EditLive!.

<editlive>
       ...
       <plugins>
          <plugin name="imageEditor" />
          <plugin name="tableToolbar" />
       </plugins>
</editlive>

Remarks

Multiple <plugin> elements can be applied to one plug-in XML file or <Plugins> Configuration File element. You can also define several plug-in XML files and reference each using several calls to the addPlugin Method.

Example
The following example specifies two plugin XML files for use with an instance of EditLive!.

var editlive = EditLiveJava("ELApplet", 700, 400);
 
...
 
editlive.addPlugin("myPlugins1.xml");
editlive.addPlugin("myPlugins2.xml");
 
...
 
editlive.show();

See Also