Ephox EditLive! for XML 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 XML through the edition of their own JavaScript functions. Allowing for greater flexibility in the use of the EditLive! for XML applet.
The raising of JavaScript events from within EditLive! for XML 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 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 XML custom toolbar button to raise a JavaScript function called javaScriptFunction.
<editLive>
...
<toolbars>
<toolbar name="command">
<customToolbarButton
name="customButton1"
text="Raise Event Button"
imageURL="http://www.someserver.com/image20x20.gif"
action="raiseEvent"
value="javaScriptFunction"
/>
</toolbar>
</toolbars>
...
</editLive>The following example demonstrates how to configure an EditLive! for XML custom menu command to raise a JavaScript function called javaScriptFunction.
<editLive>
...
<menuBar>
<menu>
<customMenuItem
name="customItem1"
text="Raise Event Command"
imageURL="http://www.someserver.com/image20x20.gif"
action="raiseEvent"
value="javaScriptFunction"
/>
</menu>
</menuBar>
...
</editLive> 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 XML raise event functionality the JavaScript function must included or defined in the same page as the instance of EditLive! for XML. The JavaScript function used should have no parameters.
The raise event functionality of EditLive! for XML can be used in a variety of situations to complement the existing functionality of the EditLive! for XML applet. For example, if a custom toolbar or menu item within EditLive! for XML 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 XML applet is embedded) and have the result of their selection placed into EditLive! for XML via the InsertHTMLAtCursor EditLive! for XML JavaScript API function.
Through the use of the raise event functionality of EditLive! for XML the functionality of the EditLive! for XML 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 XML within their applications.
Copyright 2001-2005 Ephox Corporation. All Rights Reserved.