@lexical/react
Version:
This package provides Lexical components and hooks for React applications.
45 lines (44 loc) • 1.97 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 { MenuOption, TriggerFn } from './shared/LexicalMenu.js';
import { getScrollParent as getScrollParent_ } from '@lexical/utils';
import { type LexicalCommand } from 'lexical';
/**
* The default set of punctuation characters (as a character-class fragment)
* that terminate a typeahead query. Used as the default `punctuation` option of
* {@link useBasicTypeaheadTriggerMatch}.
*/
export declare const PUNCTUATION = "\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'\"~=<>_:;";
/**
* Command dispatched while the typeahead menu is open to scroll the option at
* the given `index` into view. The built-in menu hook registers a default
* handler; custom implementations can register their own handler at a higher
* priority to override the scrolling behavior.
*/
export declare const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{
index: number;
option: MenuOption;
}>;
/** @deprecated Moved to `@lexical/utils`. Import `getScrollParent` from there. */
export declare const getScrollParent: typeof getScrollParent_;
/**
* Builds a {@link TriggerFn} for the common case of a single-character
* `trigger` (such as `@` or `#`) followed by a query. The returned function
* matches when the trigger is preceded by whitespace, an open parenthesis,
* or the start of the line
* and is followed by between `minLength` and `maxLength` non-`punctuation`
* characters (optionally allowing whitespace).
*
* @returns A memoized trigger function for {@link LexicalTypeaheadMenuPlugin}.
*/
export declare function useBasicTypeaheadTriggerMatch(trigger: string, { minLength, maxLength, punctuation, allowWhitespace, }: {
minLength?: number;
maxLength?: number;
punctuation?: string;
allowWhitespace?: boolean;
}): TriggerFn;