Class: Selection

Selection

new Selection()

The browser selection.
Source:

Methods

(static) createAroundNode(node) → {sync.api.Selection}

Create a selection around the given node.
Parameters:
Name Type Description
node HTMLElement The node which selection should wrap.
Source:
Returns:
The selection object.
Type
sync.api.Selection

(static) createEmptySelectionInNode(node, pos) → {sync.api.Selection}

Returns an object that represents a selection that is empty and is located inside the given node, at a position specified by the second parameter.
Parameters:
Name Type Description
node sync.api.dom.Node The node in which the selection is positioned.
pos string The position of the caret:
  • 'before' means before all children nodes
  • 'after' that means after all children nodes
Source:
Returns:
The selection.
Type
sync.api.Selection

getFullySelectedNode() → {sync.api.dom.Node}

Returns the node that is fully selected.
Source:
Returns:
The node which is fully selected.
Type
sync.api.dom.Node

getNodeAtCaret() → {sync.api.dom.Node}

Returns the node at caret if the selection is empty.
Source:
Returns:
The node at caret if the selection is empty.
Type
sync.api.dom.Node

isEmpty() → {boolean}

Checks whether the selection is empty.
Source:
Returns:
true if the selection is empty.
Type
boolean