Client-side API Documentation

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

hasModule

hasModuleProperty

getModuleProperty

setModuleProperty

addTagReplacementRule

insertNodeAtSelection

logic_doClean

logic_domSelect

logic_getSelectedNode

logic_removeClasses

logic_removeTag

util_stripTag

insertFormElement

insertHTML

insertHref

insertImage

insertMovieObject

insertObject

insertTemplate

logic_InsertLink

logic_InsertStyle

 

logic_setDisplayMode

logic_toggleInvisibles

setToolbarVisibility

ui_setButtonState

getSelectionHTML

loadStyleSheet

logic_FindReplace

logic_InsertHeading

util_saveSelection

util_restoreSelection

 

 

addTagReplacementRule

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.

Parameters:

 

hasModule

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.

Parameters:

hasModuleProperty

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

Parameters:

getModuleProperty

Returns the value of a KTML module's property. Use it to retrieve values from the KTML module of choice.

Parameters:

setModuleProperty

Sets the value of the specified module property. Use this method to pass values to the KTML module's properties.

Parameters:

getSelectionHTML

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.

Parameters:

 

insertFormElement

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.

Parameters:

insertHTML

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.

Parameters:

insertHref

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.

Parameters:

insertImage

Insert an image at cursor location, replacing selection. If nothing is selected, then the image is inserted at cursor position.

Parameters:

insertMovieObject

Inserts a movie object at the current selection.

Parameters:

insertNodeAtSelection

Inserts a node inside the KTML editor.

Parameters:

insertObject

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.

Parameters:

insertTemplate

Inserts specified HTML string, replacing the current selection (same as insertHTML).

Parameters:

loadStyleSheet

Loads an external CSS file into the KTML editor.

Parameters:

logic_FindReplace

Opens the Find/Replace KTML editor dialog window.

Parameters:

logic_InsertHeading

Applies the specified block formatting tag to the current KTML selection.

Parameters:

logic_InsertLink

Creates a hyperlink from the selected text or image.

Parameters:

logic_InsertStyle

Applies the specified CSS style rule to the current selection.

Parameters:

logic_doClean

Performs the specified html cleanup routine on a specified node or on the current selection in the KTML editor.

Parameters:

logic_domSelect

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.

Parameters:

logic_getSelectedNode

Returns the currently selected node.

logic_removeClasses

Removes the class attribute from the selected node inside the KTML editor

logic_removeTag

Removes the currently selected node inside the KTML editor

logic_setDisplayMode

Switch the display mode between "Code View" and "Design View" (WYSIWYG).

logic_toggleInvisibles

Toggle view of the special visual indicators (for tables having no border).

makeRequest

Performs an asynchronous request to the server and executes a callback function upon termination.

Parameters:

preserveSelection

Flag for Microsoft Internet Explorer only, used to preserve focus on the KTML editable area.

setContent

Sets the contents of the KTML editable area.

Parameters:

setToolbarVisibility

Show/hide the KTML toolbar, according to the parameter value. If set to true, the toolbar is shown.

Parameters:

ui_setButtonState

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.

util_saveSelection

Saves the current KTML selection for later use.

util_restoreSelection

Restore the previously saved selection. Use together with the previous method to allow saving and restoring content when needed.

Parameters:

util_stripTag

Removes the specified element from the KTML content, preserving current selection.

Parameters: