UNPKG

@lobehub/editor

Version:

A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.

26 lines (25 loc) 1.53 kB
import { LexicalEditor, LexicalNode, NodeKey } from 'lexical'; import type { IEditorKernel, IServiceID } from "../types"; export declare const DOM_ELEMENT_TYPE = 1; export declare const DOM_TEXT_TYPE = 3; export declare const DOM_DOCUMENT_TYPE = 9; export declare const DOM_DOCUMENT_FRAGMENT_TYPE = 11; export declare function genServiceId<T>(name: string): IServiceID<T>; export declare const noop: () => void; export declare function createEmptyEditorState(): import("lexical").EditorState; export declare function assert(cond?: boolean, message?: string): asserts cond; export declare function getNodeKeyFromDOMNode(dom: Node, editor: LexicalEditor): NodeKey | undefined; export declare function $getNodeFromDOMNode(dom: Node, editor: LexicalEditor, editorState?: ReturnType<LexicalEditor['getEditorState']>): LexicalNode | null; /** * @param x - The element being tested * @returns Returns true if x is a DOM Node, false otherwise. */ export declare function isDOMNode(x: unknown): x is Node; /** * @param x - The element being testing * @returns Returns true if x is a document fragment, false otherwise. */ export declare function isDocumentFragment(x: unknown): x is DocumentFragment; export declare function getParentElement(node: Node): HTMLElement | null; export declare function $getNearestNodeFromDOMNode(startingDOM: Node, editor: LexicalEditor, editorState?: ReturnType<LexicalEditor['getEditorState']>): LexicalNode | null; export declare function getKernelFromEditor(editor: LexicalEditor): IEditorKernel;