Skip to main content

$getCaretRange

function

Construct a CaretRange from anchor and focus carets pointing in the same direction. In order to get the expected behavior, the anchor must point towards the focus or be the same point. In the 'next' direction the anchor should be at or before the focus in the document. In the 'previous' direction the anchor should be at or after the focus in the document (similar to a backwards RangeSelection).

function $getCaretRange<D extends CaretDirection>(anchor: PointCaret<D>, focus: PointCaret<D>): CaretRange<D>

Import

import { $getCaretRange } from '@modular/sdk/editor';

Notes

returns
a CaretRange