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.

18 lines (17 loc) 774 B
import type { NodeKey } from 'lexical'; /** * A custom hook to manage the selection state of a specific node in a Lexical editor. * * This hook provides utilities to: * - Check if a node is selected. * - Update its selection state. * - Clear the selection. * * @param {NodeKey} key - The key of the node to track selection for. * @returns {[boolean, (selected: boolean) => void, () => void]} A tuple containing: * - `isSelected` (boolean): Whether the node is currently selected. * - `setSelected` (function): A function to set the selection state of the node. * - `clearSelected` (function): A function to clear the selection of the node. * */ export declare function useLexicalNodeSelection(key: NodeKey): [boolean, (selected: boolean) => void, () => void];