Skip to content

Type Editor


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

ts
new SelectionState(): SelectionState;

Returns

SelectionState

Accessors

anchorNode

Get Signature

ts
get anchorNode(): Node;

Defined in: dom-observer/SelectionState.ts:15

Returns

Node

Implementation of

ts
PmSelectionState.anchorNode;

anchorOffset

Get Signature

ts
get anchorOffset(): number;

Defined in: dom-observer/SelectionState.ts:19

Returns

number

Implementation of

ts
PmSelectionState.anchorOffset;

focusNode

Get Signature

ts
get focusNode(): Node;

Defined in: dom-observer/SelectionState.ts:23

Returns

Node

Implementation of

ts
PmSelectionState.focusNode;

Methods

clear()

ts
clear(): void;

Defined in: dom-observer/SelectionState.ts:41

Clears the selection state by resetting all nodes to null.

Returns

void

Implementation of

ts
PmSelectionState.clear;

eq()

ts
eq(sel): boolean;

Defined in: dom-observer/SelectionState.ts:53

Checks if the given selection range equals this selection state.

Parameters

ParameterTypeDescription
selDOMSelectionRangeThe selection range to compare

Returns

boolean

true if both selections are identical

Implementation of

ts
PmSelectionState.eq;

set()

ts
set(sel): void;

Defined in: dom-observer/SelectionState.ts:31

Updates the selection state with new values.

Parameters

ParameterTypeDescription
selDOMSelectionRangeThe DOM selection range to copy from

Returns

void

Implementation of

ts
PmSelectionState.set;