@keyblade/tinymce-editor-vue2 0.0.12-alpha.19 → 0.0.12-alpha.20
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/README.md +116 -108
- package/es/editor.vue.d.ts +25 -219
- package/es/editor.vue.js +18 -18
- package/es/editor.vue2.js +261 -280
- package/es/index.d.ts +85 -805
- package/es/index.js +7 -6
- package/es/types.d.ts +79 -0
- package/es/util.d.ts +6 -1
- package/es/util.js +14 -7
- package/package.json +2 -2
- package/src/index.ts +14 -30
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# tinymce 富文本编辑器
|
|
2
|
-
tinymce编辑器
|
|
2
|
+
一码游 tinymce 编辑器
|
|
3
3
|
|
|
4
4
|
## 前提
|
|
5
|
-
必须将vue 版本升级至2.7
|
|
5
|
+
必须将 `vue` 版本升级至 `2.7+`,按如下文档操作,一般来说只需要升级 vue、及 @vue/cli-xxx 版本即可
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
升级指南:https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
|
|
8
8
|
|
|
9
9
|
## 一、安装
|
|
10
10
|
```shell
|
|
11
11
|
yarn add @keyblade/tinymce-editor-vue2
|
|
12
|
-
#
|
|
13
|
-
yarn add pic-viewer@0.5.1
|
|
14
|
-
yarn add imgpond@0.6.2
|
|
12
|
+
# 下面两个是编辑器需要的第三方依赖,如原项目中有,可以不用安装,但要注意版本,必须匹配,否则css样式有问题。
|
|
13
|
+
yarn add pic-viewer@0.5.1
|
|
14
|
+
yarn add imgpond@0.6.2
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## 二、使用
|
|
@@ -31,40 +31,47 @@ Vue.use(PicViewer, {})
|
|
|
31
31
|
Vue.use(ImgPond, {})
|
|
32
32
|
|
|
33
33
|
Vue.use(TinymceEditor, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
imageUploadOptions: {
|
|
35
|
+
handleRequest: (file: File | Blob, filename: string, parameters: { extParameters: Record<string, any> }) => {
|
|
36
|
+
const form = new FormData()
|
|
37
|
+
form.append('file', file, filename)
|
|
38
|
+
postRequest('/api/man/uploadFile/uploadSingleFile', form).then((res) => {
|
|
39
|
+
console.log(res)
|
|
40
|
+
})
|
|
41
|
+
return new Promise((resolve) => {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
resolve({
|
|
44
|
+
success: true,
|
|
45
|
+
url: 'https://object.gcongo.com.cn/onecode-travel/nonClassic/8cefe379c03b5f39cd8ef725293a3c02/2024/5/1715995588295/d0b5bb458b694130be0c63e2f1d0090b.png'
|
|
46
|
+
})
|
|
47
|
+
}, 1000)
|
|
48
|
+
})
|
|
49
|
+
}
|
|
44
50
|
},
|
|
45
51
|
// 音频
|
|
46
52
|
audioUploadOptions: {
|
|
47
|
-
action: '
|
|
53
|
+
action: '/api/man/file/upload',
|
|
48
54
|
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
49
55
|
return {
|
|
50
56
|
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
51
|
-
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.
|
|
57
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJNell4T1RnNE1qSmtOVGhuWnpVM05qbGlaamM2WWpFMlpUTTBNak16Tnpkbk16RXhNVEkyTVRJek9VSk1SRnRNTjFZPTQ2VkdDWk84VzFDUSIsImlzcyI6IjM2MTFlY2IyYTY3NzMzZDk1OTI4OWQzYzM4ZjY0Y2Q3Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5XzJBZXlHOE4wQ3FFQyIsImlhdCI6MTcxNjY4NzU2MCwiZXhwIjoxNzE3MjkyMzYwfQ.PPhupuc_X0yHB3ex1dVEGVdFyCMmlGYRvZHokVIGcaU'
|
|
52
58
|
}
|
|
53
59
|
},
|
|
54
60
|
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
55
61
|
return {}
|
|
56
62
|
},
|
|
57
63
|
handlerResponse: (response: any) => {
|
|
64
|
+
debugger
|
|
58
65
|
return { url: response.data, errorMessage: response.msg }
|
|
59
66
|
}
|
|
60
67
|
},
|
|
61
68
|
// 视频
|
|
62
69
|
videoUploadOptions: {
|
|
63
|
-
action: '
|
|
70
|
+
action: '/api/man/file/upload',
|
|
64
71
|
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
65
72
|
return {
|
|
66
73
|
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
67
|
-
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.
|
|
74
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJNell4T1RnNE1qSmtOVGhuWnpVM05qbGlaamM2WWpFMlpUTTBNak16Tnpkbk16RXhNVEkyTVRJek9VSk1SRnRNTjFZPTQ2VkdDWk84VzFDUSIsImlzcyI6IjM2MTFlY2IyYTY3NzMzZDk1OTI4OWQzYzM4ZjY0Y2Q3Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5XzJBZXlHOE4wQ3FFQyIsImlhdCI6MTcxNjY4NzU2MCwiZXhwIjoxNzE3MjkyMzYwfQ.PPhupuc_X0yHB3ex1dVEGVdFyCMmlGYRvZHokVIGcaU'
|
|
68
75
|
}
|
|
69
76
|
},
|
|
70
77
|
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
@@ -103,115 +110,116 @@ onMounted(() => {
|
|
|
103
110
|
### 1.全局属性
|
|
104
111
|
```typescript
|
|
105
112
|
interface TinymceEditorGlobalOptions {
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
content: string;
|
|
113
|
-
readonly internal: boolean;
|
|
114
|
-
}) => void;
|
|
115
|
-
/** 接着默认配置进行处理 */
|
|
116
|
-
paste_postprocess?: (editor: Editor, args: {
|
|
117
|
-
node: HTMLElement;
|
|
118
|
-
readonly internal: boolean;
|
|
119
|
-
}) => void;
|
|
120
|
-
tinymceOptions?: RawEditorOptions;
|
|
113
|
+
/** 富文本编辑器选项 */
|
|
114
|
+
options?: RawEditorOptions;
|
|
115
|
+
|
|
116
|
+
/** 图片上传选项 */
|
|
117
|
+
imageUploadOptions?: ImageUploadOptions;
|
|
118
|
+
|
|
121
119
|
/** imgPond 选项 */
|
|
122
|
-
imgPondOptions?: Record<string, any
|
|
120
|
+
imgPondOptions?: Record<string, any>;
|
|
121
|
+
|
|
123
122
|
/** 音频上传选项 */
|
|
124
|
-
audioUploadOptions?:
|
|
125
|
-
|
|
126
|
-
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
127
|
-
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
128
|
-
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
129
|
-
},
|
|
123
|
+
audioUploadOptions?: AudioUploadOptions;
|
|
124
|
+
|
|
130
125
|
/** 视频上传选项 */
|
|
131
|
-
videoUploadOptions?:
|
|
132
|
-
action: string;
|
|
133
|
-
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
134
|
-
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
135
|
-
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
136
|
-
}
|
|
126
|
+
videoUploadOptions?: VideoUploadOptions;
|
|
137
127
|
}
|
|
138
128
|
```
|
|
139
129
|
|
|
140
130
|
### 2.组件属性
|
|
141
131
|
```typescript
|
|
142
|
-
interface
|
|
132
|
+
interface ComponentOptions {
|
|
143
133
|
/** vue2 v-model */
|
|
144
134
|
value?: string
|
|
145
|
-
/** vue3 v-model */
|
|
146
|
-
modelValue?: string;
|
|
147
135
|
/** 是否禁止编辑 */
|
|
148
136
|
disabled?: boolean;
|
|
149
137
|
/** 额外参数 */
|
|
150
|
-
extParameters?: Record<string, any
|
|
138
|
+
extParameters?: Record<string, any>;
|
|
139
|
+
|
|
140
|
+
/** 富文本编辑器选项 */
|
|
141
|
+
options?: Partial<RawEditorOptions>
|
|
142
|
+
|
|
143
|
+
/** 图片上传选项 */
|
|
144
|
+
imageUploadOptions?: ImageUploadOptions;
|
|
145
|
+
/** imgPond选项 */
|
|
146
|
+
imgPondOptions?: Record<string, any>;
|
|
147
|
+
|
|
148
|
+
/** 音频上传组件选项 */
|
|
149
|
+
audioUploadOptions?: AudioUploadOptions;
|
|
150
|
+
|
|
151
|
+
/** 视频上传选项 */
|
|
152
|
+
videoUploadOptions?: VideoUploadOptions;
|
|
153
|
+
|
|
154
|
+
/** 初始化完成 */
|
|
155
|
+
initComplete?: (params: { editorIns: Editor }) => void;
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 3.图片上传配置
|
|
160
|
+
```typescript
|
|
161
|
+
export interface ImageUploadOptions {
|
|
151
162
|
/** 图片上传组件最大数量 */
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
|
|
163
|
+
maxCount?: number;
|
|
164
|
+
/** 图片上传组件下方文字 */
|
|
165
|
+
tipText?: string;
|
|
155
166
|
/** 图片最大值(单位M,主要用于错误提示) */
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
|
|
159
|
-
/** 图片允许的类型 */
|
|
160
|
-
|
|
167
|
+
maxSize?: number;
|
|
168
|
+
/** 图片允许的后缀类型(小写,如: png、jpg) */
|
|
169
|
+
allowedType?: string[];
|
|
170
|
+
// /** 图片允许的类型(如: image/png、image/jpg) */
|
|
171
|
+
// allowedMineType?: string[];
|
|
161
172
|
/** 图片最小宽度 */
|
|
162
|
-
|
|
173
|
+
minWidth?: number;
|
|
163
174
|
/** 图片最小高度 */
|
|
164
|
-
|
|
175
|
+
minHeight?: number;
|
|
165
176
|
/** 图片最大宽度 */
|
|
166
|
-
|
|
177
|
+
maxWidth?: number;
|
|
167
178
|
/** 图片最大高度 */
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
|
|
171
|
-
/** 音频最大尺寸(M) */
|
|
172
|
-
audioMaxSize?: number;
|
|
173
|
-
/** 音频结尾格式 */
|
|
174
|
-
audioAllowedType?: string[];
|
|
175
|
-
/** 音频上传选项 */
|
|
176
|
-
audioUploadOptions?: {
|
|
177
|
-
action: string;
|
|
178
|
-
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
179
|
-
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
180
|
-
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
181
|
-
},
|
|
182
|
-
/** 是否开启视频 */
|
|
183
|
-
videoEnable?: boolean
|
|
184
|
-
/** 视频最大尺寸(M) */
|
|
185
|
-
videoMaxSize?: number;
|
|
186
|
-
/** 视频结尾格式 */
|
|
187
|
-
videoAllowedType?: string[];
|
|
188
|
-
/** 视频上传选项 */
|
|
189
|
-
videoUploadOptions?: {
|
|
190
|
-
action: string;
|
|
191
|
-
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
192
|
-
headers?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
193
|
-
data?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
194
|
-
}
|
|
195
|
-
/** 图片上传请求处理,需要返回图片地址 */
|
|
196
|
-
imageUploadHandle?: (file: File | Blob, filename: string, options?: {
|
|
179
|
+
maxHeight?: number;
|
|
180
|
+
/** 图片上传请求处理 */
|
|
181
|
+
handleRequest?: (file: File | Blob, filename: string, options?: {
|
|
197
182
|
extParameters?: Record<string, any>
|
|
198
183
|
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
199
|
-
/** 接着默认配置进行处理 */
|
|
200
|
-
paste_preprocess?: (editor: Editor, args: {
|
|
201
|
-
content: string;
|
|
202
|
-
readonly internal: boolean;
|
|
203
|
-
}) => void;
|
|
204
|
-
/** 接着默认配置进行处理 */
|
|
205
|
-
paste_postprocess?: (editor: Editor, args: {
|
|
206
|
-
node: HTMLElement;
|
|
207
|
-
readonly internal: boolean;
|
|
208
|
-
}) => void;
|
|
209
|
-
/** 初始化完成 */
|
|
210
|
-
initComplete?: (params: { editorIns: Editor }) => void,
|
|
211
|
-
/** 富文本编辑器选项 */
|
|
212
|
-
options?: Partial<RawEditorOptions>
|
|
213
|
-
/** imgPond 选项 */
|
|
214
|
-
imgPondOptions?: Record<string, any>
|
|
215
184
|
}
|
|
216
185
|
```
|
|
217
186
|
|
|
187
|
+
### 4.视频上传配置
|
|
188
|
+
```typescript
|
|
189
|
+
export interface VideoUploadOptions {
|
|
190
|
+
/** 是否启用 */
|
|
191
|
+
enable?: boolean;
|
|
192
|
+
/** 最大尺寸(M) */
|
|
193
|
+
maxSize?: number;
|
|
194
|
+
/** 允许的后缀类型(小写,如: mp4) */
|
|
195
|
+
allowedType?: string[];
|
|
196
|
+
/** 上传地址(启用必传) */
|
|
197
|
+
action?: string;
|
|
198
|
+
/** 请求头 */
|
|
199
|
+
headers?: (parameters: { file: File | Blob, extParameters?: Record<string, any> }) => Record<string, any>;
|
|
200
|
+
/** 额外请求体 */
|
|
201
|
+
data?: (parameters: { file: File | Blob, extParameters?: Record<string, any> }) => Record<string, any>;
|
|
202
|
+
/** 响应处理(启用必传) */
|
|
203
|
+
handlerResponse?: (response: any) => { url?: string; errorMessage?: string }
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 5.音频上传配置
|
|
208
|
+
```typescript
|
|
209
|
+
export interface AudioUploadOptions {
|
|
210
|
+
/** 是否启用 */
|
|
211
|
+
enable?: boolean;
|
|
212
|
+
/** 最大尺寸(M) */
|
|
213
|
+
maxSize?: number;
|
|
214
|
+
/** 允许的后缀类型(小写,如: mp4) */
|
|
215
|
+
allowedType?: string[];
|
|
216
|
+
/** 上传地址(启用必传) */
|
|
217
|
+
action?: string;
|
|
218
|
+
/** 请求头 */
|
|
219
|
+
headers?: (parameters: { file: File | Blob, extParameters?: Record<string, any> }) => Record<string, any>;
|
|
220
|
+
/** 额外请求体 */
|
|
221
|
+
data?: (parameters: { file: File | Blob, extParameters?: Record<string, any> }) => Record<string, any>;
|
|
222
|
+
/** 响应处理(启用必传) */
|
|
223
|
+
handlerResponse?: (response: any) => { url?: string; errorMessage?: string }
|
|
224
|
+
}
|
|
225
|
+
```
|
package/es/editor.vue.d.ts
CHANGED
|
@@ -1,258 +1,64 @@
|
|
|
1
1
|
import { Editor, RawEditorOptions } from 'tinymce';
|
|
2
|
+
import { AudioUploadOptions, ImageUploadOptions, VideoUploadOptions } from './types';
|
|
2
3
|
|
|
3
4
|
declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
4
5
|
/** vue2 v-model */
|
|
5
6
|
value?: string | undefined;
|
|
6
|
-
/** vue3 v-model */
|
|
7
|
-
modelValue?: string | undefined;
|
|
8
7
|
/** 是否禁止编辑 */
|
|
9
8
|
disabled?: boolean | undefined;
|
|
10
9
|
/** 额外参数 */
|
|
11
10
|
extParameters?: Record<string, any> | undefined;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/** 图片允许的类型 */
|
|
21
|
-
imageAllowedMineType?: string[] | undefined;
|
|
22
|
-
/** 图片最小宽度 */
|
|
23
|
-
imageMinWidth?: number | undefined;
|
|
24
|
-
/** 图片最小高度 */
|
|
25
|
-
imageMinHeight?: number | undefined;
|
|
26
|
-
/** 图片最大宽度 */
|
|
27
|
-
imageMaxWidth?: number | undefined;
|
|
28
|
-
/** 图片最大高度 */
|
|
29
|
-
imageMaxHeight?: number | undefined;
|
|
30
|
-
/** 是否开启音频 */
|
|
31
|
-
audioEnable?: boolean | undefined;
|
|
32
|
-
/** 音频最大尺寸(M) */
|
|
33
|
-
audioMaxSize?: number | undefined;
|
|
34
|
-
/** 音频结尾格式 */
|
|
35
|
-
audioAllowedType?: string[] | undefined;
|
|
36
|
-
/** 音频上传选项 */
|
|
37
|
-
audioUploadOptions?: {
|
|
38
|
-
action: string;
|
|
39
|
-
handlerResponse: (response: any) => {
|
|
40
|
-
url?: string;
|
|
41
|
-
errorMessage?: string;
|
|
42
|
-
};
|
|
43
|
-
headers?: ((parameters: {
|
|
44
|
-
file: File | Blob;
|
|
45
|
-
extParameters: Record<string, any>;
|
|
46
|
-
}) => Record<string, any>) | undefined;
|
|
47
|
-
data?: ((parameters: {
|
|
48
|
-
file: File | Blob;
|
|
49
|
-
extParameters: Record<string, any>;
|
|
50
|
-
}) => Record<string, any>) | undefined;
|
|
51
|
-
} | undefined;
|
|
52
|
-
/** 是否开启视频 */
|
|
53
|
-
videoEnable?: boolean | undefined;
|
|
54
|
-
/** 视频最大尺寸(M) */
|
|
55
|
-
videoMaxSize?: number | undefined;
|
|
56
|
-
/** 视频结尾格式 */
|
|
57
|
-
videoAllowedType?: string[] | undefined;
|
|
11
|
+
/** 富文本编辑器选项 */
|
|
12
|
+
options?: Partial<RawEditorOptions> | undefined;
|
|
13
|
+
/** 图片上传选项 */
|
|
14
|
+
imageUploadOptions?: ImageUploadOptions | undefined;
|
|
15
|
+
/** imgPond选项 */
|
|
16
|
+
imgPondOptions?: Record<string, any> | undefined;
|
|
17
|
+
/** 音频上传组件选项 */
|
|
18
|
+
audioUploadOptions?: AudioUploadOptions | undefined;
|
|
58
19
|
/** 视频上传选项 */
|
|
59
|
-
videoUploadOptions?:
|
|
60
|
-
action: string;
|
|
61
|
-
handlerResponse: (response: any) => {
|
|
62
|
-
url?: string;
|
|
63
|
-
errorMessage?: string;
|
|
64
|
-
};
|
|
65
|
-
headers?: ((parameters: {
|
|
66
|
-
file: File | Blob;
|
|
67
|
-
extParameters: {};
|
|
68
|
-
}) => Record<string, any>) | undefined;
|
|
69
|
-
data?: ((parameters: {
|
|
70
|
-
file: File | Blob;
|
|
71
|
-
extParameters: {};
|
|
72
|
-
}) => Record<string, any>) | undefined;
|
|
73
|
-
} | undefined;
|
|
74
|
-
/** 图片上传请求处理,需要返回图片地址 */
|
|
75
|
-
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
76
|
-
extParameters?: Record<string, any>;
|
|
77
|
-
}) => Promise<{
|
|
78
|
-
success: boolean;
|
|
79
|
-
url?: string;
|
|
80
|
-
errorMessage?: string;
|
|
81
|
-
}>) | undefined;
|
|
82
|
-
/** 接着默认配置进行处理 */
|
|
83
|
-
paste_preprocess?: ((editor: Editor, args: {
|
|
84
|
-
content: string;
|
|
85
|
-
readonly internal: boolean;
|
|
86
|
-
}) => void) | undefined;
|
|
87
|
-
/** 接着默认配置进行处理 */
|
|
88
|
-
paste_postprocess?: ((editor: Editor, args: {
|
|
89
|
-
node: HTMLElement;
|
|
90
|
-
readonly internal: boolean;
|
|
91
|
-
}) => void) | undefined;
|
|
20
|
+
videoUploadOptions?: VideoUploadOptions | undefined;
|
|
92
21
|
/** 初始化完成 */
|
|
93
22
|
initComplete?: ((params: {
|
|
94
23
|
editorIns: Editor;
|
|
95
24
|
}) => void) | undefined;
|
|
96
|
-
/** 富文本编辑器选项 */
|
|
97
|
-
options?: Partial<RawEditorOptions> | undefined;
|
|
98
|
-
/** imgPond 选项 */
|
|
99
|
-
imgPondOptions?: Record<string, any> | undefined;
|
|
100
25
|
}>, {
|
|
101
26
|
value: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
imageUploadTip: string;
|
|
105
|
-
imageMaxSize: number;
|
|
106
|
-
imageAllowedType: () => string[];
|
|
107
|
-
imageAllowedMineType: () => string[];
|
|
108
|
-
imageMinWidth: number;
|
|
109
|
-
imageMinHeight: number;
|
|
110
|
-
imageMaxWidth: number;
|
|
111
|
-
imageMaxHeight: number;
|
|
112
|
-
audioEnable: boolean;
|
|
113
|
-
videoEnable: boolean;
|
|
114
|
-
audioMaxSize: number;
|
|
115
|
-
videoMaxSize: number;
|
|
116
|
-
audioAllowedType: () => string[];
|
|
117
|
-
videoAllowedType: () => string[];
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
extParameters: () => {};
|
|
118
29
|
options: () => {};
|
|
119
30
|
}>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {
|
|
120
31
|
input: (value: string) => void;
|
|
121
|
-
"update:modelValue": (value: string) => void;
|
|
122
32
|
}, string, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
123
33
|
/** vue2 v-model */
|
|
124
34
|
value?: string | undefined;
|
|
125
|
-
/** vue3 v-model */
|
|
126
|
-
modelValue?: string | undefined;
|
|
127
35
|
/** 是否禁止编辑 */
|
|
128
36
|
disabled?: boolean | undefined;
|
|
129
37
|
/** 额外参数 */
|
|
130
38
|
extParameters?: Record<string, any> | undefined;
|
|
131
|
-
/**
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
|
|
139
|
-
/** 图片允许的类型 */
|
|
140
|
-
imageAllowedMineType?: string[] | undefined;
|
|
141
|
-
/** 图片最小宽度 */
|
|
142
|
-
imageMinWidth?: number | undefined;
|
|
143
|
-
/** 图片最小高度 */
|
|
144
|
-
imageMinHeight?: number | undefined;
|
|
145
|
-
/** 图片最大宽度 */
|
|
146
|
-
imageMaxWidth?: number | undefined;
|
|
147
|
-
/** 图片最大高度 */
|
|
148
|
-
imageMaxHeight?: number | undefined;
|
|
149
|
-
/** 是否开启音频 */
|
|
150
|
-
audioEnable?: boolean | undefined;
|
|
151
|
-
/** 音频最大尺寸(M) */
|
|
152
|
-
audioMaxSize?: number | undefined;
|
|
153
|
-
/** 音频结尾格式 */
|
|
154
|
-
audioAllowedType?: string[] | undefined;
|
|
155
|
-
/** 音频上传选项 */
|
|
156
|
-
audioUploadOptions?: {
|
|
157
|
-
action: string;
|
|
158
|
-
handlerResponse: (response: any) => {
|
|
159
|
-
url?: string;
|
|
160
|
-
errorMessage?: string;
|
|
161
|
-
};
|
|
162
|
-
headers?: ((parameters: {
|
|
163
|
-
file: File | Blob;
|
|
164
|
-
extParameters: Record<string, any>;
|
|
165
|
-
}) => Record<string, any>) | undefined;
|
|
166
|
-
data?: ((parameters: {
|
|
167
|
-
file: File | Blob;
|
|
168
|
-
extParameters: Record<string, any>;
|
|
169
|
-
}) => Record<string, any>) | undefined;
|
|
170
|
-
} | undefined;
|
|
171
|
-
/** 是否开启视频 */
|
|
172
|
-
videoEnable?: boolean | undefined;
|
|
173
|
-
/** 视频最大尺寸(M) */
|
|
174
|
-
videoMaxSize?: number | undefined;
|
|
175
|
-
/** 视频结尾格式 */
|
|
176
|
-
videoAllowedType?: string[] | undefined;
|
|
39
|
+
/** 富文本编辑器选项 */
|
|
40
|
+
options?: Partial<RawEditorOptions> | undefined;
|
|
41
|
+
/** 图片上传选项 */
|
|
42
|
+
imageUploadOptions?: ImageUploadOptions | undefined;
|
|
43
|
+
/** imgPond选项 */
|
|
44
|
+
imgPondOptions?: Record<string, any> | undefined;
|
|
45
|
+
/** 音频上传组件选项 */
|
|
46
|
+
audioUploadOptions?: AudioUploadOptions | undefined;
|
|
177
47
|
/** 视频上传选项 */
|
|
178
|
-
videoUploadOptions?:
|
|
179
|
-
action: string;
|
|
180
|
-
handlerResponse: (response: any) => {
|
|
181
|
-
url?: string;
|
|
182
|
-
errorMessage?: string;
|
|
183
|
-
};
|
|
184
|
-
headers?: ((parameters: {
|
|
185
|
-
file: File | Blob;
|
|
186
|
-
extParameters: {};
|
|
187
|
-
}) => Record<string, any>) | undefined;
|
|
188
|
-
data?: ((parameters: {
|
|
189
|
-
file: File | Blob;
|
|
190
|
-
extParameters: {};
|
|
191
|
-
}) => Record<string, any>) | undefined;
|
|
192
|
-
} | undefined;
|
|
193
|
-
/** 图片上传请求处理,需要返回图片地址 */
|
|
194
|
-
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
195
|
-
extParameters?: Record<string, any>;
|
|
196
|
-
}) => Promise<{
|
|
197
|
-
success: boolean;
|
|
198
|
-
url?: string;
|
|
199
|
-
errorMessage?: string;
|
|
200
|
-
}>) | undefined;
|
|
201
|
-
/** 接着默认配置进行处理 */
|
|
202
|
-
paste_preprocess?: ((editor: Editor, args: {
|
|
203
|
-
content: string;
|
|
204
|
-
readonly internal: boolean;
|
|
205
|
-
}) => void) | undefined;
|
|
206
|
-
/** 接着默认配置进行处理 */
|
|
207
|
-
paste_postprocess?: ((editor: Editor, args: {
|
|
208
|
-
node: HTMLElement;
|
|
209
|
-
readonly internal: boolean;
|
|
210
|
-
}) => void) | undefined;
|
|
48
|
+
videoUploadOptions?: VideoUploadOptions | undefined;
|
|
211
49
|
/** 初始化完成 */
|
|
212
50
|
initComplete?: ((params: {
|
|
213
51
|
editorIns: Editor;
|
|
214
52
|
}) => void) | undefined;
|
|
215
|
-
/** 富文本编辑器选项 */
|
|
216
|
-
options?: Partial<RawEditorOptions> | undefined;
|
|
217
|
-
/** imgPond 选项 */
|
|
218
|
-
imgPondOptions?: Record<string, any> | undefined;
|
|
219
53
|
}>, {
|
|
220
54
|
value: string;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
imageUploadTip: string;
|
|
224
|
-
imageMaxSize: number;
|
|
225
|
-
imageAllowedType: () => string[];
|
|
226
|
-
imageAllowedMineType: () => string[];
|
|
227
|
-
imageMinWidth: number;
|
|
228
|
-
imageMinHeight: number;
|
|
229
|
-
imageMaxWidth: number;
|
|
230
|
-
imageMaxHeight: number;
|
|
231
|
-
audioEnable: boolean;
|
|
232
|
-
videoEnable: boolean;
|
|
233
|
-
audioMaxSize: number;
|
|
234
|
-
videoMaxSize: number;
|
|
235
|
-
audioAllowedType: () => string[];
|
|
236
|
-
videoAllowedType: () => string[];
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
extParameters: () => {};
|
|
237
57
|
options: () => {};
|
|
238
58
|
}>>>, {
|
|
239
|
-
imageMaxSize: number;
|
|
240
|
-
imageAllowedType: string[];
|
|
241
|
-
imageAllowedMineType: string[];
|
|
242
|
-
imageMinWidth: number;
|
|
243
|
-
imageMinHeight: number;
|
|
244
|
-
imageMaxWidth: number;
|
|
245
|
-
imageMaxHeight: number;
|
|
246
59
|
value: string;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
imageUploadTip: string;
|
|
250
|
-
audioEnable: boolean;
|
|
251
|
-
audioMaxSize: number;
|
|
252
|
-
audioAllowedType: string[];
|
|
253
|
-
videoEnable: boolean;
|
|
254
|
-
videoMaxSize: number;
|
|
255
|
-
videoAllowedType: string[];
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
extParameters: Record<string, any>;
|
|
256
62
|
options: Partial<RawEditorOptions>;
|
|
257
63
|
}>;
|
|
258
64
|
export default _default;
|
package/es/editor.vue.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from "./editor.vue2.js";
|
|
2
2
|
import "./editor.vue3.js";
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var l;
|
|
6
|
-
var
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
}, expression: "uploadImage.formData.images" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1),
|
|
10
|
-
|
|
11
|
-
}, expression: "uploadAudio.formData.name" } })], 1),
|
|
12
|
-
|
|
13
|
-
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1),
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
import n from "./_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var c = function() {
|
|
5
|
+
var l, i, u, d, s, r, p;
|
|
6
|
+
var a = this, e = a._self._c, o = a._self._setupProxy;
|
|
7
|
+
return e("div", { staticClass: "tinymce-editor" }, [e("textarea", { ref: "insRef" }), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-image-dialog", attrs: { visible: o.uploadImage.dialogVisible, title: "插入图片", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadImageClose } }, [e("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [e("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [e(o.ImgPond, a._b({ ref: "uploadImageImgPondRef", attrs: { valueType: "array", accept: o.imgPondAccept, size: o.mergeImageUploadOptions.maxSize, count: o.mergeImageUploadOptions.maxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
|
|
8
|
+
a.$set(o.uploadImage.formData, "images", t);
|
|
9
|
+
}, expression: "uploadImage.formData.images" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), e("div", { staticClass: "tips" }, [e("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [a._v("注意:")]), e("span", [a._v("1. 单次最多可同时选择" + a._s(o.mergeImageUploadOptions.maxCount) + "张图片")]), e("span", [a._v("2. 仅支持" + a._s((i = (l = o.mergeImageUploadOptions) == null ? void 0 : l.allowedType) == null ? void 0 : i.map((t) => t.toUpperCase()).join("、")) + "格式")]), e("span", [a._v("3. 单张图片大小不可超过" + a._s(o.mergeImageUploadOptions.maxSize) + "M")]), e("span", [a._v("4. 像素不低于" + a._s(o.mergeImageUploadOptions.minWidth) + "*" + a._s(o.mergeImageUploadOptions.minHeight) + "且像素不高于" + a._s(o.mergeImageUploadOptions.maxWidth) + "*" + a._s(o.mergeImageUploadOptions.maxHeight))])])], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadImageClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadImageConfirm } }, [a._v("确定")])], 1)], 1), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: o.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadAudioClose } }, [e("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: o.uploadAudio.formData, "label-width": "auto" } }, [e("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [e("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: o.uploadAudio.formData.name, callback: function(t) {
|
|
10
|
+
a.$set(o.uploadAudio.formData, "name", t);
|
|
11
|
+
}, expression: "uploadAudio.formData.name" } })], 1), e("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [e(o.ImgPond, a._b({ ref: "audioImageImgPondRef", attrs: { valueType: "array", accept: o.imgPondAccept, size: o.mergeImageUploadOptions.maxSize, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
|
|
12
|
+
a.$set(o.uploadAudio.formData, "cover", t);
|
|
13
|
+
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), e("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [e("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((u = o.mergeAudioUploadOptions) == null ? void 0 : u.action) || "", data: o.getUploadAudioData(), accept: "audio/*", "list-type": "headTextContent", "before-upload": o.onUploadAudioBeforeUpload, headers: o.getUploadAudioHeaders(), "on-remove": o.onUploadAudioRemove, "on-success": o.onUploadAudioSuccess, "on-error": o.onUploadAudioError, limit: 1 } }, [e("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), e("i", { staticClass: "el-icon-upload el-icon--right" })]), e("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [a._v("支持音频格式:" + a._s((s = (d = o.mergeAudioUploadOptions) == null ? void 0 : d.allowedType) == null ? void 0 : s.map((t) => t.toUpperCase()).join("、")))])], 1)], 1)], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadAudioClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadAudioConfirm } }, [a._v("确定")])], 1)], 1), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-video-dialog", attrs: { visible: o.uploadVideo.dialogVisible, title: "插入视频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadVideoClose } }, [e("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: o.uploadVideo.formData, "label-width": "auto" } }, [e("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [e("el-upload", { class: ["upload", { "upload-hide": o.uploadVideo.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadVideo.formData.file, action: o.mergeVideoUploadOptions.action || "", data: o.getUploadVideoData(), accept: "video/*", "list-type": "headTextContent", "before-upload": o.onUploadVideoBeforeUpload, headers: o.getUploadVideoHeaders(), "on-remove": o.onUploadVideoRemove, "on-success": o.onUploadVideoSuccess, "on-error": o.onUploadVideoError, limit: 1 } }, [e("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), e("i", { staticClass: "el-icon-upload el-icon--right" })]), e("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [a._v("支持视频格式:" + a._s((p = (r = o.mergeVideoUploadOptions) == null ? void 0 : r.allowedType) == null ? void 0 : p.map((t) => t.toUpperCase()).join("、")))])], 1)], 1)], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadVideoClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadVideoConfirm } }, [a._v("确定")])], 1)], 1)], 1);
|
|
14
|
+
}, g = [], f = /* @__PURE__ */ n(
|
|
15
|
+
m,
|
|
16
|
+
c,
|
|
17
|
+
g
|
|
18
18
|
);
|
|
19
|
-
const
|
|
19
|
+
const U = f.exports;
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
U as default
|
|
22
22
|
};
|