Type Editor / @type-editor/view / dom-observer/SelectionState / SelectionState
Class: SelectionState
Defined in: dom-observer/SelectionState.ts:8
Represents the state of a DOM selection, tracking anchor and focus positions. This is used to detect selection changes efficiently.
Implements
PmSelectionState
Constructors
Constructor
new SelectionState(): SelectionState;Returns
SelectionState
Accessors
anchorNode
Get Signature
get anchorNode(): Node;Defined in: dom-observer/SelectionState.ts:15
Returns
Node
Implementation of
PmSelectionState.anchorNode;anchorOffset
Get Signature
get anchorOffset(): number;Defined in: dom-observer/SelectionState.ts:19
Returns
number
Implementation of
PmSelectionState.anchorOffset;focusNode
Get Signature
get focusNode(): Node;Defined in: dom-observer/SelectionState.ts:23
Returns
Node
Implementation of
PmSelectionState.focusNode;Methods
clear()
clear(): void;Defined in: dom-observer/SelectionState.ts:41
Clears the selection state by resetting all nodes to null.
Returns
void
Implementation of
PmSelectionState.clear;eq()
eq(sel): boolean;Defined in: dom-observer/SelectionState.ts:53
Checks if the given selection range equals this selection state.
Parameters
| Parameter | Type | Description |
|---|---|---|
sel | DOMSelectionRange | The selection range to compare |
Returns
boolean
true if both selections are identical
Implementation of
PmSelectionState.eq;set()
set(sel): void;Defined in: dom-observer/SelectionState.ts:31
Updates the selection state with new values.
Parameters
| Parameter | Type | Description |
|---|---|---|
sel | DOMSelectionRange | The DOM selection range to copy from |
Returns
void
Implementation of
PmSelectionState.set;