Take a look at our new Article and Redactor X editors.

set #

Arguments
el Node Element Dom

Set the selection for the entire element.

this.caret.set(element);

setStart #

Arguments
el Node Element Dom

Set the caret at the beginning of the element.

this.caret.setStart(element);

setEnd #

Arguments
el Node Element Dom

Set the caret at the end of the element.

this.caret.setEnd(element);

setBefore #

Arguments
el Node Element Dom

Set the caret before the element for inline tags or set at the end of a previous element for block tags.

this.caret.setBefore(element);

setAfter #

Arguments
el Node Element Dom

Set the caret after the element for inline tags or set a at the beginning of a next element for block tags.

this.caret.setAfter(element);

isStart #

Arguments
el (optional) Node Element Dom

Returns: Boolean

Check if the caret at the beginning of the editor or the element. Always return true If checking the caret position in a component.

// is start of editor
var is = this.caret.isStart();

// is start of element
var is = this.caret.isStart(element);

isEnd #

Arguments
el (optional) Node Element Dom

Returns: Boolean

Check if the caret at the end of the editor or the element. Always return true If checking the caret position in a component.

// is end of editor
var is = this.caret.isEnd();

// is end of element
var is = this.caret.isEnd(element);