Skip to content

Type Editor


Type Editor / @type-editor/selection-util / selection-between / selectionBetween

Function: selectionBetween()

ts
function selectionBetween(view, $anchor, $head, bias?): PmSelection;

Defined in: selection-between.ts:19

Creates a selection between two resolved positions.

This function first checks if any plugins provide a custom 'createSelectionBetween' method. If not, it falls back to creating a standard text selection. This allows plugins to implement custom selection types (e.g., table cell selections).

Parameters

ParameterTypeDescription
viewPmEditorViewThe editor view
$anchorResolvedPosThe resolved anchor position
$headResolvedPosThe resolved head position
bias?numberOptional bias for the selection direction (1 for forward, -1 for backward)

Returns

PmSelection

The created selection