Javascript Functions

This is for advanced users. The object editAreaLoader has some public functions that can be called from the page in order to manage the EditArea editors.

editAreaLoader.getValue(editor_id)

This method return the content text of the editor. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea

Returns: the content text of the editor. String

editAreaLoader.setValue(editor_id, new_text)

This method allow to update the content text of an editor. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea
new_text The new text that will replace the Editor content.

Returns: Nothing.

editAreaLoader.insertTags(editor_id, open_tag, close_tag)

This method allow to insert tags at the current position. If no text was selected, the cursor is then displayed between the open and the close tags. Otherwise, the cursor is positionned after the close tag. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea
open_tag The open tag string.
close_tag The close tag string.

Returns: Nothing.

editAreaLoader.getSelectedText(editor_id)

This method return the text contained in the the selection range. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea

Returns: The text contained in the the selection range. String

editAreaLoader.setSelectedText(editor_id, new_text)

This method allow to replace the text contained in the selection range with a given string. The selection range will then contain the new string. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea
new_text The string that will replace the current selected text.

Returns: Nothing.

editAreaLoader.getSelectionRange(editor_id)

This method return the position start and position end of the selection range in the editor. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea

Returns: An array containing the index of the selection start and end. Array("start", "end")

editAreaLoader.setSelectionRange(editor_id, new_start, new_end)

This method allow to set the selection range with the given start and end positions. Works on normal textarea if the EditArea is toggled off.

Parameters
editor_id The id of the converted textarea
new_start The character position determining the start of the selection range.
new_end The character position determining the end of the selection range.

Returns: Nothing.

editAreaLoader.execCommand(editor_id, command)

Allow to access to EditArea functions and datas (for advanced users only).

Parameters
editor_id The id of the converted textarea on witch the command should be executed.
command The function or the parameter of the EditArea object that will be returned.

Returns: the value of the executed command or data. unknown

editAreaLoader.delete_instance(editor_id)

Delete an instance of EditArea and restore simple textarea.

Parameters
editor_id The id of the converted textarea on witch the command should be executed.

Returns: Nothing.

editAreaLoader.hide(editor_id)

Hide a textarea and it's related EditArea.

Parameters
editor_id The id of the converted textarea on witch the command should be executed.

Returns: Nothing.

editAreaLoader.show(editor_id)

Restore a textarea and it's related EditArea hidden with the hide() function.

Parameters
editor_id The id of the converted textarea on witch the command should be executed.

Returns: Nothing.