Page tree
Skip to end of metadata
Go to start of metadata

This method, when given a string of relevant name-value pairs, sets the attributes for an instance of a specific tag within EditLive!. This method is designed to be used with custom menu and/or toolbar items that call functions passing tag attributes. For more information on how to use custom menu and toolbar items with EditLive!, please see the Creating Custom Menu and Toolbar Items article. 

Syntax

JavaScript
editliveInstance.setProperties(strProperties);

Parameters

strProperties

This string provides a list of name-value pairings of attributes for the relevant HTML tag. Each name and value for each pairing must be delimited by an equal sign (=) character. Name-value pairings must be delimited by a new line (\n) character.

Example

The following sets the properties for an instance of a tag inside an instance of EditLive! named editlivejs. The function setNewProperties (called by a custom menu or toolbar item) will display the name-value pairs of the tag currently selected.

//set up an instance of EditLive!
var editlivejs = new EditLiveJava("editlive", 700, 400);
editlivejs.setConfigurationFile("sample_config.xml");
editlivejs.show();
 
... 
 
//create a function which sets properties
function setNewProperties(newProperties){
   editlivejs.setProperties(newProperties);
}

The string passed to the JavaScript setProperties property must be URL encoded. It is recommended that a server-side URL encoding function be used if available as the JavaScript encodeURI function does not fully comply with the URL encoding standard.

Remarks

Each name and value for each pairing must be delimited by an equal sign (=) character.

Name-value pairings must be delimited by a new line (\n) character.

In order to correctly set the properties of the relevant tag, it should be ensured that the ephoxTagID attribute is not altered by the functions external to EditLive!. Also, the tag attribute must be present and the value of this attribute must correspond to the name of the tag (i.e. span for a <span> tag).

The value of the attribute with the name of tag designates the type of tag for which the properties are relevant. Changing the value of the tag attribute will change the tag type in EditLive!. Thus, if the value of a tag attribute with the value td was changed to th, then the relevant table cell would be changed from a normal (td) cell to a table header (th) cell.

The tag selected may contain standalone attributes. These are attributes which have only a name and do not exist as a name-value pairing (for example, the NOWRAP attribute of the <td> tag). In order to add such an attribute to the properties string, a name-value pair in which the name and value are the same (e.g. NOWRAP=NOWRAP) should be added to the properties string.

See Also

  • No labels