@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
22 lines (21 loc) • 881 B
TypeScript
/**
* 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 Klass, type LexicalEditor, type LexicalNode, type NodeKey } from 'lexical';
/**
* Attaches a DOM event listener to the editor's root element and invokes
* `eventListener` whenever an event of `eventType` targets a node that is (or
* is contained by) an instance of `nodeType`. The listener receives the DOM
* event, the editor, and the matching node's {@link NodeKey}.
*
* @returns `null`, this plugin renders no DOM of its own.
*/
export declare function NodeEventPlugin({ nodeType, eventType, eventListener, }: {
nodeType: Klass<LexicalNode>;
eventType: string;
eventListener: (event: Event, editor: LexicalEditor, nodeKey: NodeKey) => void;
}): null;