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
| Parameter | Type | Description |
|---|---|---|
view | PmEditorView | The editor view |
$anchor | ResolvedPos | The resolved anchor position |
$head | ResolvedPos | The resolved head position |
bias? | number | Optional bias for the selection direction (1 for forward, -1 for backward) |
Returns
PmSelection
The created selection