CuteEditor for ASP

Extending CuteEditor with JavaScript API

Extending CuteEditor with JavaScript API   


CuteEditor makes it easy for you to extend CuteEditor with it's JavaScript API. The goal of this section is to help you to gain comfort working with CuteEditor's JavaScript APIs.



Getting the CuteEditor Instance


In order to find the active editor, you would type: 

// get the cute editor instance. In the following example, I assume your editor ID is : Editor1

var editor1 = obj_Editor1

Getting the Active Editor Document


In order to find the active editor document, you would type:

// get the active editor document

var editdoc = editor1.GetDocument();

 

Method Description
getHTML()

This method is used for retrieving the content of CuteEditor as HTML.

Example:

// get the cute editor instance
var editor1 = obj_Editor1;

// retrieving the content of Cute Editor as HTML
var content = editor1.getHTML();
alert(content );
SetHTML() This method is used for setting the content of CuteEditor.

Example:

// get the cute editor instance
var editor1 = obj_Editor1;

// setting the content of Cute Editor
editor1.setHTML("Hello World");
PasteHTML()

This method is used for pasting the specified HTML into a range within an editor document. If anything is selected, the selection is replaced with the new HTML and text.

Example:

// get the cute editor instance
var editor1 = obj_Editor1;

// pasting the specified HTML into a range within a editor document
editor1.PasteHTML("Hello World");
FocusDocument() This method is used for setting input focus to CuteEditor

Example:

// get the cute editor instance
var editor1 = obj_Editor1;

// setting input focus to Cute Editor
editor1.FocusDocument();