/** * 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 CommandListenerPriority, type NodeKey, type TextNode } from 'lexical'; import { type JSX } from 'react'; import { MenuOption, type MenuRenderFn, type MenuResolution } from './shared/LexicalMenu.js'; /** * Props for the {@link LexicalNodeMenuPlugin} component. */ export type NodeMenuPluginProps = { onSelectOption: (option: TOption, textNodeContainingQuery: TextNode | null, closeMenu: () => void, matchingString: string) => void; options: TOption[]; nodeKey: NodeKey | null; menuRenderFn?: MenuRenderFn; onClose?: () => void; onOpen?: (resolution: MenuResolution) => void; anchorClassName?: string; commandPriority?: CommandListenerPriority; parent?: HTMLElement; }; /** * Renders a floating menu anchored to a specific node (identified by * `nodeKey`), for example to offer actions on a just-inserted node. It is the * node-anchored counterpart to {@link LexicalTypeaheadMenuPlugin}: provide the * `options` to show and an `onSelectOption` handler, and the menu opens while * `nodeKey` refers to a node and closes when it becomes `null`. * * @returns The floating menu element, or `null` when the menu is closed. */ export declare function LexicalNodeMenuPlugin({ options, nodeKey, onClose, onOpen, onSelectOption, menuRenderFn, anchorClassName, commandPriority, parent, }: NodeMenuPluginProps): JSX.Element | null; export { MenuOption, MenuRenderFn, MenuResolution };