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:
|
- 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
getNodeAtSelection() → {sync.api.dom.Node}
Returns the node at the current selection.
If the current selection is empty, the node in which the selection resides is returned.
If the selection is around an entire node, that node will be returned.
If the selection spans multiple nodes, the node where the selection has ended is returned.
- Source:
Returns:
The node at the current selection.
- Type
- sync.api.dom.Node
isEmpty() → {boolean}
Checks whether the selection is empty.
- Source:
Returns:
true if the selection is empty.
- Type
- boolean