@haklex/rich-plugin-mention (英语)
提及类型前置插件,其中包含针对跨平台的@-mentioning用户(GitHub,Twitter等)的平台选择.
安装
pnpm add @haklex/rich-plugin-mention
同伴依赖关系
| 软件包 | 版本 |
|---|---|
@lexical/react | ^0.45.0 |
lexical | ^0.45.0 |
react | >= 19 |
react-dom | >= 19 |
使用量
import { MentionMenuPlugin } from '@haklex/rich-plugin-mention';
import '@haklex/rich-plugin-mention/style.css';
function Editor() {
return (
<RichEditor>
<MentionMenuPlugin />
</RichEditor>
);
}
键入 @ 触发一个类型头菜单,用户可以在此选择一个平台并输入用户名。 带有内置平台定义的插件船,用于共同事务.
import { builtinPlatforms, getAllPlatforms, MentionMenuItem } from '@haklex/rich-plugin-mention';
import type { MentionPlatformDef, MentionMenuPluginProps } from '@haklex/rich-plugin-mention';
// Access builtin platforms
const platforms = builtinPlatforms;
const allPlatforms = getAllPlatforms();
// Define a custom platform
const customPlatform: MentionPlatformDef = {
// ...
};
出口
| 导出 | 类型 | 说明 |
|---|---|---|
MentionMenuPlugin | 构成部分 | 内部要渲染的主要插件组件 RichEditor |
MentionMenuItem | 构成部分 | 单个菜单项组件 |
builtinPlatforms | 常数 | 内建平台定义阵列 |
getAllPlatforms | 函数 | 返回所有已注册平台 |
MentionPlatformDef | 类型脚本 | 平台定义接口 |
MentionMenuPluginProps | 类型脚本 | 支持类型 MentionMenuPlugin |
子路径导出
| 路径 | 说明 |
|---|---|
@haklex/rich-plugin-mention | 插件组件、菜单项、平台设施和类型 |
@haklex/rich-plugin-mention/style.css | 样式表 |
哈克历克的一部分
此软件包是 哈克历 丰富的编辑生态系统.
许可证
麻省理工学院