Skip to main content

$comparePointCaretNext

function

A total ordering for `PointCaret<'next'>`, based on the same order that a CaretRange would iterate them. For a given origin node: - ChildCaret comes before SiblingCaret - TextPointCaret comes before SiblingCaret An exception is thrown when a and b do not have any common ancestor. This ordering is a sort of mix of pre-order and post-order because each ElementNode will show up as a ChildCaret on 'enter' (pre-order) and a SiblingCaret on 'leave' (post-order).

function $comparePointCaretNext(a: PointCaret<'next'>, b: PointCaret<'next'>): -1 | 0 | 1

Import

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

Notes

returns
-1 if a comes before b, 0 if a and b are the same, or 1 if a comes after b