SCEditor

sourceEditorInsertText()

sourceEditorInsertText(value) Since: 1.3.5

Inserts text into the source editor at the position of the cursor.

If end is not null and there is some selected text, the selected text will be placed between the start and end strings.

If there is no selection and end is set, it will just be appended to the end of start before inserting.

Info: Using the insertText() method is the prefered way of inserting text into the editor. It will check if the editor is in WYSIWYG or source mode and insert into the correct one.

Syntax

instance.sourceEditorInsertText(start[, end]);

Parameters

start
Type: String

The text to insert

end
Type: String
Default: null

If not null and there is some text selected, the selected text will be placed between the start and end strings.

If there is no selected text, this will just be appended to the end of start.

Example

Inserting text:

var textarea = ...;
var instance = sceditor.instance(textarea);

instance.sourceEditorInsertText('Hello World!');