Skip to main content

$getCommonAncestor

function

Find a common ancestor of a and b and return a detailed result object, or null if there is no common ancestor between the two nodes. The result object will have a commonAncestor property, and the other properties can be used to quickly compare these positions in the tree.

function $getCommonAncestor<A extends LexicalNode, B extends LexicalNode>(a: A, b: B): null | CommonAncestorResult<A, B>

Import

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

Notes

returns
A comparison result between the two nodes or null if they have no common ancestor