Documentation

Offset

get

Arguments
element (optional) Node, Element, Dom

Returns the object with the selection offset (start and end). Return false if the focus is not in the editor or is not in the specified element.

The editor selection offset:

var offset = this.app.offset.get();
console.log(offset.start, offset.end);

The element selection offset:

var offset = this.app.offset.get(element);
console.log(offset.start, offset.end);

set

Arguments
value Object
element (optional) Node, Element, Dom

Sets the selection in the editor or in the element by the specified object.

Set the editor offset:

this.app.offset.set({ start: 1, end: 10 });

Set the element offset:

this.app.offset.set(element, { start: 1, end: 10 });