@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
30 lines (29 loc) • 1.26 kB
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 { ElementNode } from 'lexical';
import { type ChangeHandler, type LinkMatcher } from '@lexical/link';
import { type JSX } from 'react';
export { type ChangeHandler, createLinkMatcherWithRegExp, type LinkMatcher, } from '@lexical/link';
/**
* Automatically converts text that matches one of the provided `matchers` into
* {@link AutoLinkNode}s as the user types, and reverts them back to plain text
* when they no longer match. Provide `onChange` to react to links being
* created, updated, or removed, and `excludeParents` to skip matching inside
* particular ancestor nodes. The editor must have the {@link AutoLinkNode}
* registered.
*
* This is a legacy plugin. When building an editor with the extension API,
* configure {@link AutoLinkExtension} instead.
*
* @returns `null`, this plugin renders no DOM of its own.
*/
export declare function AutoLinkPlugin({ matchers, onChange, excludeParents, }: {
matchers: LinkMatcher[];
onChange?: ChangeHandler;
excludeParents?: ((parent: ElementNode) => boolean)[];
}): JSX.Element | null;