SCEditor

getOuterText()

getOuterText(before, length) Since: 1.4.3

Gets the text left or right of the current selction/caret.

Syntax

var text = instance.getOuterText(before, length);

Parameters

before
Type: Boolean

If to get the text before or after the current selection.

length
Type: Integer

The number of characters to get from the left or right of the current selection.

Return

Type: String

Example

Get 10 characters before the current selection:

var textarea = ...;
var text = sceditor.instance(textarea)
    .getRangeHelper()
    .getOuterText(true, 10);

Get 5 characters after the current selection:

var textarea = ...;
var text = sceditor.instance(textarea)
    .getRangeHelper()
    .getOuterText(false, 5);