Skip to content

Type Editor


Type Editor / @type-editor/state / selection/SelectionRange / SelectionRange

Class: SelectionRange

Defined in: state/src/selection/SelectionRange.ts:10

Represents a selected range in a document. A range has a start position ($from) and an end position ($to). Most selections consist of a single range, but some selection types may use multiple ranges to represent discontinuous selections.

Implements

  • PmSelectionRange

Constructors

Constructor

ts
new SelectionRange($from, $to): SelectionRange;

Defined in: state/src/selection/SelectionRange.ts:30

Create a range.

Parameters

ParameterTypeDescription
$fromResolvedPosThe lower bound of the range (resolved position)
$toResolvedPosThe upper bound of the range (resolved position)

Returns

SelectionRange

Accessors

$from

Get Signature

ts
get $from(): ResolvedPos;

Defined in: state/src/selection/SelectionRange.ts:40

The resolved lower bound of the range.

Returns

ResolvedPos

The starting position

Implementation of

ts
PmSelectionRange.$from;

$to

Get Signature

ts
get $to(): ResolvedPos;

Defined in: state/src/selection/SelectionRange.ts:49

The resolved upper bound of the range.

Returns

ResolvedPos

The ending position

Implementation of

ts
PmSelectionRange.$to;