/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import type { EditorConfig, LexicalEditor } from './LexicalEditor'; import type { RangeSelection } from './LexicalSelection'; import { ElementNode } from '.'; export declare type NodeMap = Map; export declare type SerializedLexicalNode = { type: string; version: number; }; export declare function removeNode(nodeToRemove: LexicalNode, restoreSelection: boolean, preserveEmptyParent?: boolean): void; export declare function $getNodeByKeyOrThrow(key: NodeKey): N; export declare type DOMConversion = { conversion: DOMConversionFn; priority: 0 | 1 | 2 | 3 | 4; }; export declare type DOMConversionFn = (element: T, parent?: Node) => DOMConversionOutput | null; export declare type DOMChildConversion = (lexicalNode: LexicalNode, parentLexicalNode: LexicalNode | null | undefined) => LexicalNode | null | undefined; export declare type DOMConversionMap = Record DOMConversion | null>; declare type NodeName = string; export declare type DOMConversionOutput = { after?: (childLexicalNodes: Array) => Array; forChild?: DOMChildConversion; node: LexicalNode | null; }; export declare type DOMExportOutput = { after?: (generatedElement: HTMLElement | null | undefined) => HTMLElement | null | undefined; element: HTMLElement | null; }; export declare type NodeKey = string; export declare class LexicalNode { [x: string]: any; /** @internal */ __type: string; /** @internal */ __key: string; /** @internal */ __parent: null | NodeKey; static getType(): string; static clone(_data: unknown): LexicalNode; constructor(key?: NodeKey); getType(): string; isAttached(): boolean; isSelected(): boolean; getKey(): NodeKey; getIndexWithinParent(): number; getParent(): T | null; getParentOrThrow(): T; getTopLevelElement(): ElementNode | this | null; getTopLevelElementOrThrow(): ElementNode | this; getParents(): Array; getParentKeys(): Array; getPreviousSibling(): T | null; getPreviousSiblings(): Array; getNextSibling(): T | null; getNextSiblings(): Array; getCommonAncestor(node: LexicalNode): T | null; is(object: LexicalNode | null | undefined): boolean; isBefore(targetNode: LexicalNode): boolean; isParentOf(targetNode: LexicalNode): boolean; getNodesBetween(targetNode: LexicalNode): Array; isDirty(): boolean; getLatest(): this; getWritable(): this; getTextContent(_includeInert?: boolean, _includeDirectionless?: false): string; getTextContentSize(includeInert?: boolean, includeDirectionless?: false): number; createDOM(_config: EditorConfig, _editor: LexicalEditor): HTMLElement; updateDOM(_prevNode: unknown, _dom: HTMLElement, _config: EditorConfig): boolean; exportDOM(editor: LexicalEditor): DOMExportOutput; exportJSON(): SerializedLexicalNode; static importJSON(_serializedNode: SerializedLexicalNode): LexicalNode; remove(preserveEmptyParent?: boolean): void; replace(replaceWith: N): N; insertAfter(nodeToInsert: LexicalNode): LexicalNode; insertBefore(nodeToInsert: LexicalNode): LexicalNode; selectPrevious(anchorOffset?: number, focusOffset?: number): RangeSelection; selectNext(anchorOffset?: number, focusOffset?: number): RangeSelection; markDirty(): void; } export {};