@yuntijs/ui
Version:
☁️ Yunti UI - an open-source UI component library for building Cloud Native web apps
45 lines (44 loc) • 1.55 kB
TypeScript
import type { MenuOption, TypeaheadMenuPluginProps } from '@lexical/react/LexicalTypeaheadMenuPlugin';
import React from 'react';
import type { MentionOption } from '../../types';
import { type MentionMenuOption } from './utils';
export interface MentionPickerPluginProps extends Pick<TypeaheadMenuPluginProps<MenuOption>, 'onOpen'> {
/** The className of menu overlay */
overlayClassName?: string;
/** The options of menu */
options?: MentionOption[];
/**
* The characters that trigger the mention menu. Needed to tell the plugin
* when to call the query function.
*/
triggers: string[];
/**
* If `true`, mentions can contain spaces.
* @default true
*/
allowSpaces?: boolean;
/**
* Regular expression that matches punctuation characters when looking for
* mentions.
*
* In addition to spaces, these characters can appear directly after a mention.
* E.g. `@John!` or `@John,`.
* @default \.,\*\?\$\|#{}\(\)\^\[\]\/!%'\"~=<>_:;
*/
punctuation?: string;
/**
* Regular expression that matches characters that can appear directly
* before the trigger character.
* @default \(
*/
preTriggerChars?: string;
/**
* When mention selected, this func will be called
*/
onSelect?: (option: MentionMenuOption, trigger: string | null, queryString: string | null) => void;
/**
* Parent element
*/
parent?: HTMLElement;
}
export declare const MentionPickerPlugin: React.FC<MentionPickerPluginProps>;