Skip to main content

$normalizeCaret

function

Normalize a caret to the deepest equivalent PointCaret. This will return a TextPointCaret with the offset set according to the direction if given a caret with a TextNode origin or a caret with an ElementNode origin with the deepest ChildCaret having an adjacent TextNode. If given a TextPointCaret, it will be returned, as no normalization is required when an offset is already present.

function $normalizeCaret<D extends CaretDirection>(initialCaret: PointCaret<D>): PointCaret<D>

Import

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

Notes

returns
The normalized PointCaret