Skip to main content

$insertNodeToNearestRootAtCaret

function

If the insertion caret is the root/shadow root node (see $isRootOrShadowRoot), the node will be inserted there, otherwise the parent nodes will be split according to the given options.

function $insertNodeToNearestRootAtCaret<T extends LexicalNode, D extends CaretDirection>(node: T, caret: PointCaret<D>, options?: SplitAtPointCaretNextOptions): NodeCaret<D>

Import

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

Notes

returns
The node after its insertion