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.

39 lines (38 loc) 1.68 kB
import { LexicalEditor, RangeSelection, TextNode } from 'lexical'; /** * Get the text content of the editor up to the anchor point of the selection. * Get the text content before the anchor point of the selection * @param selection Selection object from Lexical editor * @returns */ export declare function getTextUpToAnchor(selection: RangeSelection): string | null; /** * * @param editor Lexical editor instance * Get the text content before the selection anchor point in the editor * @returns */ export declare function getQueryTextForSearch(editor: LexicalEditor): string | null; export declare function tryToPositionRange(leadOffset: number, range: Range, editorWindow: Window): boolean; export declare function getScrollParent(element: HTMLElement, includeHidden: boolean): HTMLElement | HTMLBodyElement; export declare const scrollIntoViewIfNeeded: (target: HTMLElement) => void; export declare const PUNCTUATION = "\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;"; export declare function getBasicTypeaheadTriggerMatch(trigger: string, { minLength, maxLength, punctuation, allowWhitespace, }: { allowWhitespace?: boolean; maxLength?: number; minLength?: number; punctuation?: string; }): (text: string) => { leadOffset: number; matchingString: string; replaceableString: string; } | null; /** * Split Lexical TextNode and return a new TextNode only containing matched text. * Common use cases include: removing the node, replacing with a new node. */ export declare function $splitNodeContainingQuery(match: { leadOffset: number; matchingString: string; replaceableString: string; }): TextNode | null;