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.

36 lines (35 loc) 2.04 kB
import type { ElementNode, LexicalNode, SerializedLexicalNode } from 'lexical'; import type { ElementTransformer } from "../../markdown/service/transformers"; export declare const sampleReader: (format: number, xmlElement: Element, children: any[]) => any[]; export declare const createBlockNode: (createNode: (match: Array<string>, parentNode: ElementNode) => ElementNode) => ElementTransformer['replace']; /** * Returns the root's text content. * @returns The root's text content. */ export declare function $rootTextContent(): string; /** * Determines if the root has any text content and can trim any whitespace if it does. * @param isEditorComposing - Is the editor in composition mode due to an active Input Method Editor? * @param trim - Should the root text have its whitespaced trimmed? Defaults to true. * @returns true if text content is empty, false if there is text or isEditorComposing is true. */ export declare function $isRootTextContentEmpty(isEditorComposing: boolean, trim?: boolean): boolean; /** * Determines if the input should show the placeholder. If anything is in * in the root the placeholder should not be shown. * @param isComposing - Is the editor in composition mode due to an active Input Method Editor? * @returns true if the input should show the placeholder, false otherwise. */ export declare function $canShowPlaceholder(isComposing: boolean): boolean; /** * Returns a function that executes {@link $canShowPlaceholder} * @param isEditorComposing - Is the editor in composition mode due to an active Input Method Editor? * @returns A function that executes $canShowPlaceholder with arguments. */ export declare function $canShowPlaceholderCurry(isEditorComposing: boolean): () => boolean; export declare function $isCursorInTable(selection: any): { inCell: boolean; inTable: boolean; }; export declare function $isCursorInQuote(selection: any): boolean; export declare function exportNodeToJSON<SerializedNode extends SerializedLexicalNode>(node: LexicalNode): SerializedNode;