Ephox EditLive! for Java allows for the developer to specify custom items on the toolbars and menus. These custom items can be used to insert specific HTML source or a hyperlink at the cursor location, it can also be used to raise a JavaScript event. For information on how to configure EditLive! for Java to include custom menu and toolbar items see the <customToolbarButton>, <customToolbarCombo> and <customMenuItem> elements in the EditLive! for Java XML Reference.
There are two types of custom items which can be added to the EditLive! for Java toolbar, these are custom toolbar buttons and custom toolbar combo items. Custom toolbar buttons appear as buttons within the toolbar and when configuring these within the EditLive! for Java XML configuration file a URL which corresponds to an image for the button must be included. This image is used on the button when it is placed in the toolbar. Custom combo boxes appear in the same format as the typeface, style and font size toolbar items. When configuring custom combo boxes for use within EditLive! for Java each individual item within the combo box must be configured via the <customComboBoxItem> element in the EditLive! for Java XML configuration file.
The following example demonstrates how to define a custom toolbar button for use within EditLive! for Java on the Command Toolbar. The button defined in this example will insert HTML to insert at the cursor, note that the value in the example below is URL encoded.
<editLiveForJava>
...
<toolbars>
<commandToolbar>
<customToolbarButton
name="customButton1"
text="Custom Button"
imageURL="http://www.someserver.com/image20x20.gif"
action="insertHTMLAtCursor"
value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
</commandToolbar>
</toolbars>
...
</editLiveForJava>
The following example demonstrates how to define a custom combo box item for use within a custom toolbar combo box which exists on the EditLive! for Java Command Toolbar. The combo box item defined in this example will insert HTML to insert at the cursor, note that the value in the example below is URL encoded.
<editLiveForJava>
...
<toolbars>
<commandToolbar>
<customToolbarComboBox
name="customCombo">
<customComboBoxItem
name="customComboItem1"
text="Custom Combo Item"
action="insertHTMLAtCursor"
value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
</customToolbarComboBox>
</commandToolbar>
</toolbars>
...
</editLiveForJava>
Custom menu items in EditLive! for Java can only be of one format. Custom menu items can only be of a single layered depth (i.e. they cannot include submenus). Custom menu items can be added to any of the menus in EditLive! for Java via the <customMenuItem> in the EditLive! for Java XML configuration file.
The following example demonstrates how to define a custom menu item for use within EditLive! for Java. The menu item defined in this example will insert HTML to insert at the cursor, note that the value in the example below is URL encoded.
<editLiveForJava>
...
<menuBar>
...
<menu>
<customMenuItem
name="customItem1"
text="Custom Item"
imageURL="http://www.someserver.com/image20x20.gif"
action="insertHTMLAtCursor"
value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
</menu>
...
</menuBar>
...
</editLiveForJava>
Custom toolbar buttons and combo boxes, and custom menu items can be configured within EditLive! for Java to insert specific HTML source or hyperlinks at the location of the cursor. When configuring custom toolbar buttons, combo boxes and menu items within EditLive! for Java to insert HTML at the cursor the HTML source to be inserted at the cursor needs to be specified within the EditLive! for Java XML configuration file. When declaring the HTML to insert in the XML configuration file the HTML needs to be URL encoded.
The insert hyperlink at cursor custom functionality in EditLive! for Java requires that the user select text before using the relevant custom item. Upon using the relevant custom item the selected text will become a hyperlink linking to the address specified in the configuration of the custom item.
The HTML or hyperlink to insert at the location of the cursor is specified via the value attribute of the related <customComboBoxItem>, <customToolbarButton> or <customMenuItem> element in the XML configuration file.
The following example demonstrates how to define a custom menu item which uses the insertHTMLAtCursor action for use within EditLive! for Java. The menu item defined in this example will insert HTML to insert at the cursor, note that the value in the example below is URL encoded.
<editLiveForJava>
...
<menuBar>
...
<menu>
<customMenuItem
name="customItem1"
text="Custom Item"
imageURL="http://www.someserver.com/image20x20.gif"
action="insertHTMLAtCursor"
value="%3Cp%3EHTML%20to%20insert%3C/p%3E" />
</menu>
...
</menuBar>
...
</editLiveForJava>
The following example demonstrates how to define a custom menu item which uses the insertHyperlinkAtCursor action for use within EditLive! for Java. The menu item defined in this example will insert the URL http://www.ephox.com at the cursor.
<editLiveForJava>
...
<menuBar>
...
<menu>
<customMenuItem
name="customItem2"
text="Ephox"
imageURL="http://www.someserver.com/image20x20.gif"
action="insertHyperlinkAtCursor"
value="http://www.ephox.com" />
</menu>
...
</menuBar>
...
</editLiveForJava>
Custom toolbar and menu items in EditLive! for Java can be configured to raise JavaScript events. JavaScript events raised through EditLive! for Java are required to be defined either in the page in which EditLive! for Java is embedded or must be defined in a file which is included in the page in which EditLive! for Java is embedded.
When raising a JavaScript event from EditLive! for Java the value attribute of the related <customComboBoxItem>, <customToolbarButton> or <customMenuItem> element in the XML configuration file should specify the JavaScript function which is to be called.
Note: The raiseEvent functionality of EditLive! for Java should not be used when using an implementation of the EditLive! for Java JavaBean.
The following example demonstrates how to define a custom menu item which uses the raiseEvent action for use within EditLive! for Java. The menu item defined in this example will call the JavaScript function called eventRaised.
<editLiveForJava>
...
<menuBar>
...
<menu>
<customMenuItem
name="customItem1"
text="Raise Event"
imageURL="http://www.someserver.com/image20x20.gif"
action="raiseEvent"
value="eventRaised" />
</menu>
...
</menuBar>
...
</editLiveForJava>
The developer can create extended customized functionality in EditLive! for Java via the custom toolbar and menu items. These items can be configured to insert a specific hyperlink or specific HTML at the cursor. They can also be configured to raise specific JavaScript events.
Copyright © 2001-2004 Ephox Corporation. All Rights Reserved.