EditLive! 9 Documentation : action (Applet)

This element specifies a custom action to be performed with empty tags (i.e. tags with no body such as <img>) within EditLive!.

The action element only supports standard HTML tags. The action element cannot be used to target custom tags.

Configuration Element Tree Structure

<editLive>
<wysiwygEditor>
<customTags>
<doubleClickActions>
<action (Applet)>

<editLive>
   ...
      <wysiwygEditor>
         <customTags>
            <doubleClickActions>
               <action ... />
            </doubleClickActions>
         </customTags>
      </wysiwygEditor>
   ...
</editLive>

Required Attributes

name

The empty tag for which this action applies.

action

The action which this custom action performs. This attribute has the following possible values:

  • insertHTMLAtCursor - Insert the given HTML at the cursor.
  • insertHyperlinkAtCursor - Insert the given hyperlink at the cursor.
  • raiseEvent - Call a JavaScript function with the name specified in the value attribute.
  • customPropertiesDialog - Call a JavaScript function with the name specified in the value attribute. The current tag's properties are also passed to this function as a string.
  • PostDocument - Post the content of the applet to a server-side script.

The actions available for empty tags are the same actions available for custom menu and toolbar items. For more information on these actions, please see the Creating Custom Menu and Toolbar Items article.

value

The value of this attribute depends on the value specified in the action attribute.

  • insertHTMLAtCursor - value will be a string of HTML.
  • insertHyperlinkAtCursor - value will be a URL.
  • raiseEvent - value will be the name of the JavaScript function to call.
  • customPropertiesDialog - value will be the name of the JavaScript function to call, passing the current tag's attributes as a string.
  • PostDocument- the value attribute is used to specify several different parameters. Each parameter is delimited with the string ##ephox##. The following are the different parameters that can be specified through the value attribute:
    • Post Field
      The name of the field in the HTTP POST that EditLive! uses to POST its content.

      This parameter is required.

    • Post Acceptor URL
      The URL for the POST acceptor that EditLive! for Java is to POST to.

      The parameter is required.

    • Response Processing
      The operation that EditLive! is to perform with the HTTP response from the POST acceptor script. The parameter can have the following values:
      1. saveToDisk - Presents the user with a save file dialog, with which they can save the response to the local machine.
      2. callback- Passes the entire content of the HTTP response to a specified JavaScript callback function for processing.

        This parameter is required.

    • JavaScript Callback Function
      The name of the JavaScript callback function to use for processing the response.

      This parameter should only be used if the repsonse processing is set to callback.

The parameters specified through the value attribute string must appear in the order Post Field, Post Acceptor URL, Response Processing, and JavaScript Callback Function (if needed).

Example

The following parameters specified through the value attribue string would store the contents of EditLive! in a hidden HTML form field called POST_field, sending the contents via HTTP Post to http://someserver/postacceptor.jsp, then call back the JavaScript function called JSFunction.

value="POST_field##ephox##http://someserver/postacceptor.jsp##ephox## callback##ephox##JSFunction"

When using the insertHTMLAtCursor action the HTML to be inserted must be URL encoded in the XML file. For example, <p>HTML to insert<p> becomes %3Cp%3EHTML%20to%20insert%3C/p%3E.

Examples

The following example demonstrates how to define a JavaScript method to be raised upon double clicking any <img> tag. The name of the JavaScript function to be raised is jsFunction.

<editLive>
  ...
  <wysiwygEditor>
    <customTags>
      <doubleClickActions>
        <action 
          name="img"
          action="raiseEvent"
          value="jsFunction"
        />
      </doubleClickActions>
    </customTags>
    ...
  </wysiwygEditor>    
  ...
</editLive> 

For more examples of using the <action> configuration file element, see the Custom Operations for Menu and Toolbar Items section of the Creating Custom Menu and Toolbar Items article. The functionality and format of the <customMenuItem>, <customToolbarButton>, and Creating Custom Menu and Toolbar Items <customComboBoxItem> attributes is the same as the <action> attributes.

Remarks

The <action> element can appear multiple times within the <doubleClickActions> element.

The <action> element must be a complete tag; it cannot contain a tag body. Therefore, the tag must be closed in the same line. See the example below:

<action name=... />

Text assigned to the value attribute must be URL encoded as it is in the example above.

The actions available for empty tags are the same actions available for custom tags. For more information on these actions see the Custom Operations for Menu and Toolbar Items section of the Creating Custom Menu and Toolbar Items article.

See Also