2.0.9 • Published 5 months ago
fish-chat-editor v2.0.9
安装
# NPM
$ npm install fish-chat-editor
# Yarn
$ yarn add fish-chat-editor
# pnpm
$ pnpm install fish-chat-editor
使用
// main.tsx
import "fish-chat-editor/dist/index.css";
import FishChatEditor from "fish-chat-editor";
<FishChatEditor />;
API
Editor props
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
placeholder | 提示占位符 | string | —— |
className | 扩展类名 | string | —— |
emojiList | 表情列表数据,请看下面的IEmojiType描述 | IEmojiType[] | —— |
toolbarRender | 自定义工具栏内容 | () => ReactNode | —— |
onSend | 点击发送按钮事件 | (editor) => void | —— |
onEnterDown | 编辑器键盘回车事件 | (editor) => void | —— |
onChange | 编辑器内容变化时 | (editor) => void | —— |
beforePasteImage | 粘贴图片之前的钩子, 参数files为粘贴的文件,amount为富文本中已有的图片个数; 若返回为空数组则停止粘贴,若返回为文件数组则继续处理 | (files: File[], amount: number) => File[] or [] | —— |
Editor Methods
名称 | 说明 | 类型 |
---|---|---|
clear | 清空输入框值 | () => void |
focus | 获取焦点 | () => void |
blur | 失去焦点 | () => void |
fishEditor | 编辑器 API (具体看FishEditor描述) | obj as FishEditor |
IEmojiType描述
export type IEmojiType = {
/** 表情的url地址 */
url: string;
/** 表情的名称,必须是“[爱心]”的格式 */
name: string;
/** 表情的tip提示名 */
title: string;
};
// 如:
export const emoji: { [key: string]: string } = {
"[爱你]": "www.cc.com/[爱你].png"
};
2.0.9
5 months ago
2.0.8
5 months ago
2.0.7
5 months ago
2.0.6
5 months ago
2.0.5
6 months ago
2.0.3
6 months ago
2.0.4
6 months ago
2.0.2
6 months ago
2.0.1
6 months ago
1.2.2
8 months ago
1.2.1
9 months ago
1.2.0
9 months ago
1.1.3
9 months ago
1.1.2
9 months ago
1.1.1
9 months ago
1.1.0
9 months ago
1.0.9
9 months ago
1.0.8
9 months ago
1.0.79
9 months ago
1.0.78
9 months ago
1.0.75
9 months ago
1.0.7
9 months ago
1.0.6
11 months ago
1.0.5
11 months ago
1.0.4
12 months ago
1.0.3
12 months ago
1.0.2
12 months ago