This topic contains a listing of all methods and their parameters used in the KTML client-side API.
|
Modules |
DOM and Tags Manipulation |
Inserting objects |
Visibility and view switching |
Other |
|
|
This method allows defining a new tag replacement rule. KTML can dynamically alter the generated HTML code by replacing one tag for another, according to a set of rules. Aside some predefined rules, you can define your own by calling this method after the ktml object is created
Add a tag replacement rule to be executed by KTML on the edited HTML page, just before updating the value of the bounded form element. The rule determines what tags will be replaced, and with what values.
tagRuleName a tag replacement rule name. Used as a key to identify the rule inside the internal KTML tag replacement tag map.
sTagName the tag to be replaced. Only add the tag content, without the < and > signs. E.g. to replace the <p> tag, pass only p as parameter.
sTagRule the name of new tag to replace the old tag with. Only add the tag content, without the < and > signs. E.g. to use the <h1> tag instead of another, pass only h1 as parameter.
This method checks if a KTML module has been loaded. Use this method when in need to access functions of a module, to check if it is available. KTML supports both server-side and client-side modules, which must be correctly loaded before their functionality can be used. You can learn more about creating and customizing the modules here.
moduleName the name of the module to be checked for.
Check if the specified module has the specified property. Use this method to check if the desired property actually exists in the scope of a module before using it. This allows you to prevent calling non-existent properties of a module
moduleName the module name.
propertyName the name of the property to search for.
Returns the value of a KTML module's property. Use it to retrieve values from the KTML module of choice.
moduleName the module name
propertyName the name of the property
Sets the value of the specified module property. Use this method to pass values to the KTML module's properties.
moduleName the name of the module
propertyName the name of the property
propertyValue the new property value
Returns the currently selected HTML inside the KTML editor. You can use this method to get the the HTML selected by the user. If nothing has been selected, the method returns an empty string.
Insert a form element at cursor location, replacing the current selection. If the current selection is not contained inside a <FORM> tag, the user is asked if he wants to add a form along with the new element.
elementType - the name of the element to be inserted. If you pass a wrong argument, an error message is displayed. For the elementType you can use one of the following:
form
textfield
textarea
button
checkbox
radiobutton
listmenu
filefield
imagefield
hiddenfield
fieldset
label
Insert the specified html string, replacing the current selection. If nothing is selected, the HTML string is inserted at the cursor position. You can also specify what to set the selection to after the string has been inserted.
sHTML html string to insert
select_what indicates what to select after insertion. Valid values are:after, first-node, first-leaf.
Inserts a hyperlink. The hyperlink text depends on current selection: if nothing is selected the link text will be the href, if some text is selected the text will be transformed to a link. If an image is selected the link will wrap the image.
href the link href/location
Insert an image at cursor location, replacing selection. If nothing is selected, then the image is inserted at cursor position.
imgPath the path to the image file to insert into the document.
Inserts a movie object at the current selection.
media_type the media class. Recognized values for the type are: flashmovie, windowsmedia
movie_type the movie type within the selected media class. Valid values are swf for flashmovie and asf,avi,wmv for windowsmedia.
imgPath path to the movie file.
Inserts a node inside the KTML editor.
insertNode the node to be inserted; may be created with ktml.edit.createElement(tagName), utility.dom.createElement(tagName, elementsPropertiesHash),or may a another node from the ktml.edit document
bOverwriteSelection specifies whether the new node will overwrite the selection. The default value is false. This means that the node to insert will be added after the selection.
Performs the same task as the insertNodeAtSelection method. The difference lies in the default value of the bOverwriteSelection parameter which is set by default to TRUE, thus overwriting the current selection, if any.
nNode the node to be inserted; may be created with ktml.edit.createElement(tagName), utility.dom.createElement(tagName, elementsPropertiesHash),or may a another node from the ktml.edit document
bOverwriteSelection specifies whether the new node will overwrite the selection. The default value is true.
Inserts specified HTML string, replacing the current selection (same as insertHTML).
content HTML template string to insert.
Loads an external CSS file into the KTML editor.
pathToStyle the path to the style sheet, absolute path.
Opens the Find/Replace KTML editor dialog window.
Applies the specified block formatting tag to the current KTML selection.
hName the block format to be applied. Valid values are: p, h1-h6, addr, pre
Creates a hyperlink from the selected text or image.
prm the link location
Applies the specified CSS style rule to the current selection.
stName the name of the CSS style rule to be applied
Performs the specified html cleanup routine on a specified node or on the current selection in the KTML editor.
type the cleanup type to perform. Valid values are: all,word,formatting,css Learn what they do here.
node optional, the node to be cleaned up. If the parameter is missing, and a selection has been made inside the editor, the method applied on it. If nothing is selected, the method applied on the entire document.
Selects a DOM node inside the KTML editor. Document Object Model (DOM) nodes are the blocks that make up the HTML documents. Learn more about the DOM here.
selectionTarget a DOM node specifying the node to select, or an integer, index inside the current selected nodes DOM hierarchy, as shown in the Tag Inspector
ind specified or null, indicates the type of selection to be made; Valid values are:
1 - text selection
2 - control selection;
NULL - the selection type is automatically determined depending on the tag name of the node to be selected.
collapse whether to collapse the selection after the selected node or not. Valid values are yes and no. The default value is no.
Returns the currently selected node.
Removes the class attribute from the selected node inside the KTML editor
Removes the currently selected node inside the KTML editor
Switch the display mode between "Code View" and "Design View" (WYSIWYG).
Toggle view of the special visual indicators (for tables having no border).
Performs an asynchronous request to the server and executes a callback function upon termination.
module the KTML server-side module to use.
method the name of the module method to execute
postParams a hash containing the parameters required by the specified method
fct the function to be executed when the Ajax call returns.
Flag for Microsoft Internet Explorer only, used to preserve focus on the KTML editable area.
Sets the contents of the KTML editable area.
text - the string to assign to the KTML editor. It can contain HTML tags, and will be rendered correctly by KTML.
Show/hide the KTML toolbar, according to the parameter value. If set to true, the toolbar is shown.
flag decide whether to show the toolbar or not. Valid values are true and false.
Updates the state of all elements of the KTML interface: toolbar buttons, tag inspector, property inspector. You should use this method after altering the state of a KTML interface element to ensure the correct display and functionality.
Saves the current KTML selection for later use.
Restore the previously saved selection. Use together with the previous method to allow saving and restoring content when needed.
dofocus flag that specifies whether to set focus back to the editor area
Removes the specified element from the KTML content, preserving current selection.
tag the tag to be removed