Ephox EditLive! for Java custom menu commands and custom toolbar buttons may be configured so that they raise a JavaScript event. This allows developers to complement the functionality of EditLive! for Java through the edition of their own JavaScript functions. Allowing for greater flexibility in the use of the EditLive! for Java applet.
The raising of JavaScript events from within EditLive! for Java can be associated with either a custom menu command or a custom toolbar button. In order to create a custom menu command or toolbar button with this functionality the EditLive! for Java XML configuration file must contain the relevant settings. For more information on the EditLive! configuration file see the Configuration Documentation.
The following example demonstrates how to configure an EditLive! for Java custom toolbar button to raise a JavaScript function called javaScriptFunction.
<editLiveForJava>
...
<toolbars>
<commandToolbar>
<customToolbarButton
name="customButton1"
text="Raise Event Button"
imageURL="http://www.someserver.com/image20x20.gif"
action="raiseEvent"
value="javaScriptFunction" />
</commandToolbar>
</toolbars>
...
</editLiveForJava>
The following example demonstrates how to configure an EditLive! or Java custom menu command to raise a JavaScript function called javaScriptFunction.
<editLiveForJava>
...
<menuBar>
<menu>
<customMenuItem
name="customItem1"
text="Raise Event Command"
imageURL="http://www.someserver.com/image20x20.gif"
action="raiseEvent"
value="javaScriptFunction" />
</menu>
</menuBar>
...
</editLiveForJava>
For more information on each of the XML attributes present in these tags please see the <customToolbarButton> or <customMenuItem> element documentation.
In order to be able to use a JavaScript function with the EditLive! for Java raise event functionality the JavaScript function must included in or defined in the same page as the relevant instance of EditLive! for Java. The JavaScript function used should have no parameters.
The raise event functionality of EditLive! for Java can be used in a variety of situations to complement the existing functionality of the EditLive! for Java applet. For example, if a custom toolbar or menu item within EditLive! for Java was to call a JavaScript function which, in turn, called the window.open() function the new window created, with the use of some program scripting, could be used to receive extra user input. Thus, a user may be able to select an image or file from a list presented in a new window, submit their selection back to another function in the parent page (the page in which the EditLive! for Java applet is embedded) and have the result of their selection placed into EditLive! for Java via the InsertHTMLAtCursor EditLive! for Java JavaScript API function.
Through the use of the raise event functionality of EditLive! for Java the functionality of the EditLive! for Java applet can be complemented by the developer through the use of JavaScript functions. This affords the developer a large degree of flexibility when using EditLive! for Java within their applications.
Copyright © 2001-2004 Ephox Corporation. All Rights Reserved.