Skip to main content

$getAdjacentSiblingOrParentSiblingCaret

function

Returns the Node sibling when this exists, otherwise the closest parent sibling. For example R -> P -> T1, T2 -> P2 returns T2 for node T1, P2 for node T2, and null for node P2.

function $getAdjacentSiblingOrParentSiblingCaret<D extends CaretDirection>(startCaret: NodeCaret<D>, rootMode?: RootMode): null | [NodeCaret<D>, number]

Import

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

Notes

returns
An array (tuple) containing the found caret and the depth difference, or null, if this node doesn't exist.