Skip to main content

$rewindSiblingCaret

function

Given a SiblingCaret we can always compute a caret that points to the origin of that caret in the same direction. The adjacent caret of the returned caret will be equivalent to the given caret.

function $rewindSiblingCaret<T extends LexicalNode, D extends CaretDirection>(caret: SiblingCaret<T, D>): NodeCaret<D>

Import

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

Notes

example
```ts siblingCaret.is($rewindSiblingCaret(siblingCaret).getAdjacentCaret()) ```
returns
A new caret (ChildCaret or SiblingCaret) with the same direction