Skip to main content

$getTextPointCaretSlice

function

Construct a TextPointCaretSlice given a TextPointCaret and a signed distance. The distance should be negative to slice text before the caret's offset, and positive to slice text after the offset. The direction of the caret itself is not relevant to the string coordinates when working with a TextPointCaretSlice but mutation operations will preserve the direction.

function $getTextPointCaretSlice<T extends TextNode, D extends CaretDirection>(caret: TextPointCaret<T, D>, distance: number): TextPointCaretSlice<T, D>

Import

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

Notes

returns
TextPointCaretSlice