@para-ui/core 2.2.43 → 2.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ComboSelect/index.js +1 -1
- package/DynamicMultiBox/index.js +1 -1
- package/Form/index.js +1 -1
- package/FormItem/index.js +1 -1
- package/README.md +12 -3
- package/TextEditor/common.d.ts +11 -0
- package/TextEditor/index.d.ts +127 -0
- package/TextEditor/index.js +177 -0
- package/cdn/ComboSelect/index.js +1 -1
- package/cdn/DynamicMultiBox/index.js +1 -1
- package/cdn/Form/index.js +1 -1
- package/cdn/FormItem/index.js +1 -1
- package/cdn/TextEditor/index.js +230 -0
- package/index.d.ts +2 -0
- package/index.js +167 -4
- package/package.json +5 -3
- package/style.css +2 -0
package/README.md
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
## 版本: 2.2.45
|
|
2
|
+
|
|
3
|
+
para-ui/core@2.2.45 发布
|
|
4
|
+
【富文本编辑器-TextEditor】增加富文本编辑器组件
|
|
5
|
+
|
|
6
|
+
## 版本: 2.2.44
|
|
7
|
+
|
|
8
|
+
para-ui/core@2.2.44 发布
|
|
9
|
+
【组合选择器-ComboSelect】兼容ie,滚动容器 overflow:'hidden auto'修改为 overflowX:'hidden' overflowY:'auto'
|
|
10
|
+
|
|
1
11
|
## 版本: 2.2.43
|
|
2
12
|
|
|
3
13
|
para-ui/core@2.2.43 发布
|
|
4
14
|
【超出省略-AutoTips】修改计算方式,兼容mac: safari,firefox,chrome,windows: IE, firefox,chrome
|
|
5
15
|
|
|
6
|
-
|
|
7
16
|
## 版本: 2.2.42
|
|
8
17
|
|
|
9
18
|
para-ui/core@2.2.42 发布
|
|
@@ -331,8 +340,8 @@
|
|
|
331
340
|
|
|
332
341
|
para-ui/core@2.1.39 发布
|
|
333
342
|
【Table】修改分页页数显示,从接口获取
|
|
334
|
-
【Form】表单组件新增 comboSelect 输入类型
|
|
335
|
-
【Form】表单组件新增通用组件类型引用方法
|
|
343
|
+
【Form】表单组件新增 comboSelect 输入类型
|
|
344
|
+
【Form】表单组件新增通用组件类型引用方法
|
|
336
345
|
【Form】表单配置项新增 itemType配置项 和 InputType,功能相同
|
|
337
346
|
【Form】表单对象新增reset方法,重置表单为最初状态
|
|
338
347
|
【Help】修复placement无效
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author xh
|
|
3
|
+
* @date 2022/09/06 11:26
|
|
4
|
+
* @description 基于wangEditor的富文本编辑器
|
|
5
|
+
*/
|
|
6
|
+
import React, { ReactNode } from "react";
|
|
7
|
+
import { LabelTooltipProps } from "../Label";
|
|
8
|
+
import { IDomEditor } from "@wangeditor/editor";
|
|
9
|
+
import { HelperTextProps } from "../HelperText";
|
|
10
|
+
import "./index.scss";
|
|
11
|
+
import "@wangeditor/editor/dist/css/style.css";
|
|
12
|
+
type InsertFnType = (url: string, alt: string, href: string) => void;
|
|
13
|
+
export interface IMenuGroup {
|
|
14
|
+
key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
iconSvg?: string;
|
|
17
|
+
menuKeys: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface UpLoadImgConfig {
|
|
20
|
+
/** form-data fieldName ,默认值 'wangeditor-uploaded-image' */
|
|
21
|
+
fieldName: string;
|
|
22
|
+
/** 单个文件的最大体积限制,默认为 2M */
|
|
23
|
+
/** 1 * 1024 * 1024(1M) */
|
|
24
|
+
maxFileSize: number;
|
|
25
|
+
/** 最多可上传几个文件,默认为 100) */
|
|
26
|
+
maxNumberOfFiles: number;
|
|
27
|
+
/** 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 [] */
|
|
28
|
+
allowedFileTypes: string[];
|
|
29
|
+
/** 自定义上传参数,例如传递验证的 token 等。参数会被添加到 formData 中,一起上传到服务端。*/
|
|
30
|
+
meta: object;
|
|
31
|
+
/** 将 meta 拼接到 url 参数中,默认 false */
|
|
32
|
+
metaWithUrl: boolean;
|
|
33
|
+
/** 自定义增加 http header */
|
|
34
|
+
headers: object;
|
|
35
|
+
/** 跨域是否传递 cookie ,默认为 false */
|
|
36
|
+
withCredentials: boolean;
|
|
37
|
+
/** 超时时间,默认为 10 秒 */
|
|
38
|
+
/** 5 * 1000(5秒) */
|
|
39
|
+
timeout: number;
|
|
40
|
+
/** 小于该值就插入 base64 格式(而不上传),默认为 0 */
|
|
41
|
+
/** 5 * 1024(5kb) */
|
|
42
|
+
base64LimitSize: number;
|
|
43
|
+
/** 单个文件上传成功之后 */
|
|
44
|
+
onSuccess: (file: File, res: any) => void;
|
|
45
|
+
/** 单个文件上传失败 */
|
|
46
|
+
onFailed: (file: File, res: any) => void;
|
|
47
|
+
/** 上传进度回调 */
|
|
48
|
+
onProgress: (progress: number) => void;
|
|
49
|
+
/** 上传之前触发 */
|
|
50
|
+
onBeforeUpload: (file: File) => any;
|
|
51
|
+
/** 上传错误,或者触发 timeout 超时 */
|
|
52
|
+
onError: (file: File, err: any, res: any) => void;
|
|
53
|
+
/** 用户自定义图片上传 */
|
|
54
|
+
customUpload: (file: File, insertFn: InsertFnType) => void;
|
|
55
|
+
/** 用户自定义图片插入 */
|
|
56
|
+
customInsert: (res: any, insertFn: InsertFnType) => void;
|
|
57
|
+
}
|
|
58
|
+
export type UpLoadVideoConfig = Omit<UpLoadImgConfig, "base64LimitSize">;
|
|
59
|
+
export interface TextEditorProps extends HelperTextProps {
|
|
60
|
+
/** 样式class */
|
|
61
|
+
className?: string;
|
|
62
|
+
/** style */
|
|
63
|
+
style?: React.CSSProperties;
|
|
64
|
+
/** toolbarStyle */
|
|
65
|
+
toolbarStyle?: React.CSSProperties;
|
|
66
|
+
/** editorStyle */
|
|
67
|
+
editorStyle?: React.CSSProperties;
|
|
68
|
+
/** 富文本的最大长度 */
|
|
69
|
+
max?: number;
|
|
70
|
+
/** 标题 */
|
|
71
|
+
label?: ReactNode;
|
|
72
|
+
/** 标题提示 */
|
|
73
|
+
labelSign?: ReactNode;
|
|
74
|
+
/** 帮组提示信息 */
|
|
75
|
+
labelTooltip?: LabelTooltipProps;
|
|
76
|
+
/** 提示语 */
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
/** 编辑器是否默认聚焦 */
|
|
79
|
+
autoFocus?: boolean;
|
|
80
|
+
/** 只读 */
|
|
81
|
+
readOnly?: boolean;
|
|
82
|
+
/** 是否必填 */
|
|
83
|
+
required?: boolean;
|
|
84
|
+
/** 默认值 不受控 */
|
|
85
|
+
defaultValue?: string;
|
|
86
|
+
/** 默认值 受控 */
|
|
87
|
+
value?: string;
|
|
88
|
+
/** 工具栏菜单配置*/
|
|
89
|
+
toolbarKeys?: Array<string | IMenuGroup>;
|
|
90
|
+
/** 工具栏不需要的配置 */
|
|
91
|
+
excludeKeys?: string[];
|
|
92
|
+
/** 工具栏插入新菜单 */
|
|
93
|
+
insertKeys?: {
|
|
94
|
+
index: number;
|
|
95
|
+
keys: string | Array<string | IMenuGroup>;
|
|
96
|
+
};
|
|
97
|
+
/** 文件上传的服务地址 */
|
|
98
|
+
server: string;
|
|
99
|
+
/** 上传图片配置 */
|
|
100
|
+
uploadImage?: Partial<UpLoadImgConfig>;
|
|
101
|
+
/** 上传视频配置 */
|
|
102
|
+
uploadVideo?: Partial<UpLoadVideoConfig>;
|
|
103
|
+
/** 国际化 */
|
|
104
|
+
in18?: "en" | "zh-CN";
|
|
105
|
+
/** 改变事件 */
|
|
106
|
+
onChange?: (value: string, text: string) => void;
|
|
107
|
+
/** 失去焦点 */
|
|
108
|
+
onBlur?: (editor: IDomEditor) => void;
|
|
109
|
+
/** 得到焦点 */
|
|
110
|
+
onFocus?: (editor: IDomEditor) => void;
|
|
111
|
+
/** 编辑器销毁钩子 */
|
|
112
|
+
onDestroyed?: (editor: IDomEditor) => void;
|
|
113
|
+
}
|
|
114
|
+
export interface TextEditorRef {
|
|
115
|
+
/** 获取html内容 */
|
|
116
|
+
getContent: () => string | undefined;
|
|
117
|
+
/** 获取纯文本内容 */
|
|
118
|
+
getText: () => string | undefined;
|
|
119
|
+
/** 清空编辑器 */
|
|
120
|
+
clearEditor: () => void;
|
|
121
|
+
/** 设置content */
|
|
122
|
+
setContent: (content: string) => void;
|
|
123
|
+
/** 获取编辑器实例 */
|
|
124
|
+
getEditor: () => IDomEditor | null;
|
|
125
|
+
}
|
|
126
|
+
declare const TextEditor: React.ForwardRefExoticComponent<TextEditorProps & React.RefAttributes<TextEditorRef>>;
|
|
127
|
+
export default TextEditor;
|