@keyblade/tinymce-editor-vue2 0.0.12-alpha.4 → 0.0.12-alpha.7
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 +123 -26
- package/es/editor.vue.d.ts +46 -8
- package/es/editor.vue.js +10 -10
- package/es/editor.vue2.js +193 -148
- package/es/index.d.ts +164 -28
- package/package.json +1 -1
- package/src/index.ts +4 -4
package/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# tinymce 富文本编辑器
|
|
2
|
-
|
|
2
|
+
tinymce编辑器
|
|
3
|
+
|
|
4
|
+
## 零、前提
|
|
5
|
+
必须将vue 版本升级至2.7+
|
|
6
|
+
|
|
7
|
+
- 升级指南:https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
|
|
8
|
+
|
|
9
|
+
一般来说只需要升级 vue、及 @vue/cli-xxx 版本即可
|
|
3
10
|
|
|
4
11
|
## 一、安装
|
|
5
12
|
```shell
|
|
6
13
|
yarn add @keyblade/tinymce-editor-vue2
|
|
14
|
+
# 下面两个第三方依赖注意版本,必须匹配,否则css样式有问题
|
|
7
15
|
yarn add pic-viewer@0.5.1 (如项目中有,怎不需要再次安装)
|
|
8
16
|
yarn add imgpond@0.6.2 (如项目中有,怎不需要再次安装)
|
|
9
17
|
```
|
|
@@ -25,14 +33,54 @@ Vue.use(PicViewer, {})
|
|
|
25
33
|
Vue.use(ImgPond, {})
|
|
26
34
|
|
|
27
35
|
Vue.use(TinymceEditor, {
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
imageUploadHandle: (file, filename, parameters: { extParameters: Record<string, any> }) => {
|
|
37
|
+
const form = new FormData()
|
|
38
|
+
form.append('file', file, filename)
|
|
39
|
+
postRequest('/api/man/uploadFile/uploadSingleFile', form).then((res) => {
|
|
40
|
+
debugger
|
|
41
|
+
})
|
|
30
42
|
return new Promise((resolve) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
setTimeout(() => {
|
|
44
|
+
resolve({
|
|
45
|
+
success: true,
|
|
46
|
+
url: 'https://object.gcongo.com.cn/onecode-travel/nonClassic/8cefe379c03b5f39cd8ef725293a3c02/2024/5/1715995588295/d0b5bb458b694130be0c63e2f1d0090b.png'
|
|
47
|
+
})
|
|
48
|
+
}, 1000)
|
|
35
49
|
})
|
|
50
|
+
},
|
|
51
|
+
// 音频
|
|
52
|
+
audioUploadOptions: {
|
|
53
|
+
action: 'https://qt.gcongo.com.cn/msg/file/upload',
|
|
54
|
+
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
55
|
+
return {
|
|
56
|
+
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
57
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
61
|
+
return {}
|
|
62
|
+
},
|
|
63
|
+
handlerResponse: (response: any) => {
|
|
64
|
+
return { url: response.data, errorMessage: response.msg }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
// 视频
|
|
68
|
+
videoUploadOptions: {
|
|
69
|
+
action: 'https://qt.gcongo.com.cn/msg/file/upload',
|
|
70
|
+
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
71
|
+
return {
|
|
72
|
+
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
73
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
77
|
+
return {
|
|
78
|
+
a: '1'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
handlerResponse: (response: any) => {
|
|
82
|
+
return { url: response.data, errorMessage: response.msg }
|
|
83
|
+
}
|
|
36
84
|
}
|
|
37
85
|
})
|
|
38
86
|
```
|
|
@@ -40,14 +88,14 @@ Vue.use(TinymceEditor, {
|
|
|
40
88
|
### 2.使用组件
|
|
41
89
|
```text
|
|
42
90
|
<template>
|
|
43
|
-
<
|
|
91
|
+
<KbTinymceEditor
|
|
44
92
|
v-model="text"
|
|
93
|
+
:extParameters="{a: 1}"
|
|
45
94
|
/>
|
|
46
95
|
</template>
|
|
47
96
|
|
|
48
97
|
<script setup lang="ts">
|
|
49
98
|
import { onMounted, ref } from 'vue'
|
|
50
|
-
import TinymceEditor from '@keyblade/tinymce-editor-vue2'
|
|
51
99
|
|
|
52
100
|
const text = ref<string>('')
|
|
53
101
|
|
|
@@ -57,21 +105,18 @@ onMounted(() => {
|
|
|
57
105
|
</script>
|
|
58
106
|
```
|
|
59
107
|
|
|
108
|
+
### 3.使用工具类(单独使用图片上传组件的,可使用这两个工具类自行处理)
|
|
109
|
+
```typescript
|
|
110
|
+
import { oneTravelImageCheck, oneTravelImageCompressor } from '@keyblade/tinymce-editor-vue2'
|
|
111
|
+
|
|
112
|
+
// oneTravelImageCheck: 一码游图片检测工具
|
|
113
|
+
// oneTravelImageCompressor: 一码游图片压缩工具
|
|
114
|
+
```
|
|
115
|
+
|
|
60
116
|
## 三、Api
|
|
61
117
|
### 1.全局属性
|
|
62
118
|
```typescript
|
|
63
119
|
interface TinymceEditorGlobalOptions {
|
|
64
|
-
// 消息方法实例
|
|
65
|
-
message?: {
|
|
66
|
-
// 加载中
|
|
67
|
-
loading?: (message?: string) => { close: () => void }
|
|
68
|
-
// 成功
|
|
69
|
-
success?: (message?: string) => void
|
|
70
|
-
// 错误提示
|
|
71
|
-
error?: (message?: string) => void
|
|
72
|
-
// 销毁
|
|
73
|
-
destroy?: () => void
|
|
74
|
-
}
|
|
75
120
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
76
121
|
imageUploadHandle?: (file: File | Blob, filename: string, options?: {
|
|
77
122
|
extParameters?: Record<string, any>
|
|
@@ -86,8 +131,23 @@ interface TinymceEditorGlobalOptions {
|
|
|
86
131
|
node: HTMLElement;
|
|
87
132
|
readonly internal: boolean;
|
|
88
133
|
}) => void;
|
|
89
|
-
|
|
90
|
-
|
|
134
|
+
tinymceOptions?: RawEditorOptions;
|
|
135
|
+
/** imgPond 选项 */
|
|
136
|
+
imgPondOptions?: Record<string, any>
|
|
137
|
+
/** 音频上传选项 */
|
|
138
|
+
audioUploadOptions?: {
|
|
139
|
+
action: string;
|
|
140
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
141
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
142
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
143
|
+
},
|
|
144
|
+
/** 视频上传选项 */
|
|
145
|
+
videoUploadOptions?: {
|
|
146
|
+
action: string;
|
|
147
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
148
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
149
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
150
|
+
}
|
|
91
151
|
}
|
|
92
152
|
```
|
|
93
153
|
|
|
@@ -97,9 +157,15 @@ interface ComponentProps {
|
|
|
97
157
|
/** vue2 v-model */
|
|
98
158
|
value?: string
|
|
99
159
|
/** vue3 v-model */
|
|
100
|
-
modelValue?: string
|
|
160
|
+
modelValue?: string;
|
|
101
161
|
/** 是否禁止编辑 */
|
|
102
162
|
disabled?: boolean;
|
|
163
|
+
/** 额外参数 */
|
|
164
|
+
extParameters?: Record<string, any>,
|
|
165
|
+
/** 图片上传组件最大数量 */
|
|
166
|
+
imageUploadMaxCount?: number;
|
|
167
|
+
/** 图片上传提示 */
|
|
168
|
+
imageUploadTip?: string;
|
|
103
169
|
/** 图片最大值(单位M,主要用于错误提示) */
|
|
104
170
|
imageMaxSize?: number;
|
|
105
171
|
/** 图片允许的类型 */
|
|
@@ -114,8 +180,36 @@ interface ComponentProps {
|
|
|
114
180
|
imageMaxWidth?: number;
|
|
115
181
|
/** 图片最大高度 */
|
|
116
182
|
imageMaxHeight?: number;
|
|
183
|
+
/** 是否开启音频 */
|
|
184
|
+
audioEnable?: boolean
|
|
185
|
+
/** 音频最大尺寸(M) */
|
|
186
|
+
audioMaxSize?: number;
|
|
187
|
+
/** 音频结尾格式 */
|
|
188
|
+
audioAllowedType?: string[];
|
|
189
|
+
/** 音频上传选项 */
|
|
190
|
+
audioUploadOptions?: {
|
|
191
|
+
action: string;
|
|
192
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
193
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
194
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
195
|
+
},
|
|
196
|
+
/** 是否开启视频 */
|
|
197
|
+
videoEnable?: boolean
|
|
198
|
+
/** 视频最大尺寸(M) */
|
|
199
|
+
videoMaxSize?: number;
|
|
200
|
+
/** 视频结尾格式 */
|
|
201
|
+
videoAllowedType?: string[];
|
|
202
|
+
/** 视频上传选项 */
|
|
203
|
+
videoUploadOptions?: {
|
|
204
|
+
action: string;
|
|
205
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
206
|
+
headers?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
207
|
+
data?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
208
|
+
}
|
|
117
209
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
118
|
-
imageUploadHandle?: (file: File | Blob, filename: string
|
|
210
|
+
imageUploadHandle?: (file: File | Blob, filename: string, options?: {
|
|
211
|
+
extParameters?: Record<string, any>
|
|
212
|
+
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
119
213
|
/** 接着默认配置进行处理 */
|
|
120
214
|
paste_preprocess?: (editor: Editor, args: {
|
|
121
215
|
content: string;
|
|
@@ -128,7 +222,10 @@ interface ComponentProps {
|
|
|
128
222
|
}) => void;
|
|
129
223
|
/** 初始化完成 */
|
|
130
224
|
initComplete?: (params: { editorIns: Editor }) => void,
|
|
131
|
-
/**
|
|
225
|
+
/** 富文本编辑器选项 */
|
|
132
226
|
options?: Partial<RawEditorOptions>
|
|
227
|
+
/** imgPond 选项 */
|
|
228
|
+
imgPondOptions?: Record<string, any>
|
|
133
229
|
}
|
|
134
|
-
```
|
|
230
|
+
```
|
|
231
|
+
|
package/es/editor.vue.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
27
27
|
imageMaxWidth?: number | undefined;
|
|
28
28
|
/** 图片最大高度 */
|
|
29
29
|
imageMaxHeight?: number | undefined;
|
|
30
|
+
/** 是否开启音频 */
|
|
31
|
+
audioEnable?: boolean | undefined;
|
|
30
32
|
/** 音频最大尺寸(M) */
|
|
31
33
|
audioMaxSize?: number | undefined;
|
|
32
34
|
/** 音频结尾格式 */
|
|
@@ -38,9 +40,17 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
38
40
|
url?: string;
|
|
39
41
|
errorMessage?: string;
|
|
40
42
|
};
|
|
41
|
-
headers?:
|
|
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;
|
|
43
51
|
} | undefined;
|
|
52
|
+
/** 是否开启视频 */
|
|
53
|
+
videoEnable?: boolean | undefined;
|
|
44
54
|
/** 视频最大尺寸(M) */
|
|
45
55
|
videoMaxSize?: number | undefined;
|
|
46
56
|
/** 视频结尾格式 */
|
|
@@ -52,8 +62,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
52
62
|
url?: string;
|
|
53
63
|
errorMessage?: string;
|
|
54
64
|
};
|
|
55
|
-
headers?:
|
|
56
|
-
|
|
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;
|
|
57
73
|
} | undefined;
|
|
58
74
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
59
75
|
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
@@ -93,6 +109,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
93
109
|
imageMinHeight: number;
|
|
94
110
|
imageMaxWidth: number;
|
|
95
111
|
imageMaxHeight: number;
|
|
112
|
+
audioEnable: boolean;
|
|
113
|
+
videoEnable: boolean;
|
|
96
114
|
audioMaxSize: number;
|
|
97
115
|
videoMaxSize: number;
|
|
98
116
|
audioAllowedType: () => string[];
|
|
@@ -128,6 +146,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
128
146
|
imageMaxWidth?: number | undefined;
|
|
129
147
|
/** 图片最大高度 */
|
|
130
148
|
imageMaxHeight?: number | undefined;
|
|
149
|
+
/** 是否开启音频 */
|
|
150
|
+
audioEnable?: boolean | undefined;
|
|
131
151
|
/** 音频最大尺寸(M) */
|
|
132
152
|
audioMaxSize?: number | undefined;
|
|
133
153
|
/** 音频结尾格式 */
|
|
@@ -139,9 +159,17 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
139
159
|
url?: string;
|
|
140
160
|
errorMessage?: string;
|
|
141
161
|
};
|
|
142
|
-
headers?:
|
|
143
|
-
|
|
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;
|
|
144
170
|
} | undefined;
|
|
171
|
+
/** 是否开启视频 */
|
|
172
|
+
videoEnable?: boolean | undefined;
|
|
145
173
|
/** 视频最大尺寸(M) */
|
|
146
174
|
videoMaxSize?: number | undefined;
|
|
147
175
|
/** 视频结尾格式 */
|
|
@@ -153,8 +181,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
153
181
|
url?: string;
|
|
154
182
|
errorMessage?: string;
|
|
155
183
|
};
|
|
156
|
-
headers?:
|
|
157
|
-
|
|
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;
|
|
158
192
|
} | undefined;
|
|
159
193
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
160
194
|
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
@@ -194,6 +228,8 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
194
228
|
imageMinHeight: number;
|
|
195
229
|
imageMaxWidth: number;
|
|
196
230
|
imageMaxHeight: number;
|
|
231
|
+
audioEnable: boolean;
|
|
232
|
+
videoEnable: boolean;
|
|
197
233
|
audioMaxSize: number;
|
|
198
234
|
videoMaxSize: number;
|
|
199
235
|
audioAllowedType: () => string[];
|
|
@@ -211,8 +247,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
211
247
|
imageUploadMaxCount: number;
|
|
212
248
|
imageUploadTip: string;
|
|
213
249
|
imageAllowedType: string[];
|
|
250
|
+
audioEnable: boolean;
|
|
214
251
|
audioMaxSize: number;
|
|
215
252
|
audioAllowedType: string[];
|
|
253
|
+
videoEnable: boolean;
|
|
216
254
|
videoMaxSize: number;
|
|
217
255
|
videoAllowedType: string[];
|
|
218
256
|
options: Partial<RawEditorOptions>;
|
package/es/editor.vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u from "./editor.vue2.js";
|
|
2
2
|
import "./editor.vue3.js";
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var l
|
|
3
|
+
import i from "./_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var d = function() {
|
|
5
|
+
var l;
|
|
6
6
|
var e = this, a = e._self._c, o = e._self._setupProxy;
|
|
7
7
|
return a("div", { staticClass: "tinymce-editor" }, [a("textarea", { ref: "insRef" }), e._v(" "), a("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 } }, [a("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [a("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, count: e.imageUploadMaxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
|
|
8
8
|
e.$set(o.uploadImage.formData, "images", t);
|
|
@@ -10,13 +10,13 @@ var r = function() {
|
|
|
10
10
|
e.$set(o.uploadAudio.formData, "name", t);
|
|
11
11
|
}, expression: "uploadAudio.formData.name" } })], 1), a("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
|
|
12
12
|
e.$set(o.uploadAudio.formData, "cover", t);
|
|
13
|
-
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((l = o.mergeAudioUploadOptions) == null ? void 0 : l.action) || "", data:
|
|
14
|
-
},
|
|
13
|
+
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((l = o.mergeAudioUploadOptions) == null ? void 0 : l.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 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持音频格式:" + e._s(e.audioAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadAudioClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadAudioConfirm } }, [e._v("确定")])], 1)], 1), a("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 } }, [a("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: o.uploadVideo.formData, "label-width": "auto" } }, [a("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("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 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持视频格式:" + e._s(e.videoAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadVideoClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadVideoConfirm } }, [e._v("确定")])], 1)], 1)], 1);
|
|
14
|
+
}, s = [], r = /* @__PURE__ */ i(
|
|
15
|
+
u,
|
|
15
16
|
d,
|
|
16
|
-
|
|
17
|
-
p
|
|
17
|
+
s
|
|
18
18
|
);
|
|
19
|
-
const
|
|
19
|
+
const f = r.exports;
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
f as default
|
|
22
22
|
};
|
package/es/editor.vue2.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImageCheck as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as ue, ref as m, computed as w, onMounted as me, onUnmounted as pe, watch as R } from "vue";
|
|
2
|
+
import { oneTravelImageCheck as E, oneTravelImageCompressor as O, getImagePixel as ce } from "./util.js";
|
|
3
|
+
import ge from "imgpond";
|
|
4
4
|
import { conclude as M } from "vue-global-config";
|
|
5
5
|
import I from "tinymce";
|
|
6
|
-
import
|
|
6
|
+
import fe from "./langs/zh_CN.js";
|
|
7
7
|
import "tinymce/skins/ui/oxide/skin";
|
|
8
8
|
import "tinymce/models/dom";
|
|
9
9
|
import "tinymce/themes/silver";
|
|
@@ -33,8 +33,8 @@ import "tinymce/plugins/visualblocks";
|
|
|
33
33
|
import "tinymce/plugins/visualchars";
|
|
34
34
|
import "tinymce/plugins/wordcount";
|
|
35
35
|
import { globalProps as x } from "./index.js";
|
|
36
|
-
import { Loading as
|
|
37
|
-
const
|
|
36
|
+
import { Loading as ve, Message as v } from "element-ui";
|
|
37
|
+
const Ze = /* @__PURE__ */ ue({
|
|
38
38
|
__name: "editor",
|
|
39
39
|
props: {
|
|
40
40
|
value: { default: "" },
|
|
@@ -50,9 +50,11 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
50
50
|
imageMinHeight: { default: 60 },
|
|
51
51
|
imageMaxWidth: { default: 6e3 },
|
|
52
52
|
imageMaxHeight: { default: 6e3 },
|
|
53
|
+
audioEnable: { type: Boolean, default: !0 },
|
|
53
54
|
audioMaxSize: { default: 200 },
|
|
54
55
|
audioAllowedType: { default: () => ["MP3", "M4A", "WAV", "AAC"] },
|
|
55
56
|
audioUploadOptions: null,
|
|
57
|
+
videoEnable: { type: Boolean, default: !0 },
|
|
56
58
|
videoMaxSize: { default: 300 },
|
|
57
59
|
videoAllowedType: { default: () => ["MP4", "3GP"] },
|
|
58
60
|
videoUploadOptions: null,
|
|
@@ -64,27 +66,27 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
64
66
|
imgPondOptions: null
|
|
65
67
|
},
|
|
66
68
|
emits: ["input", "update:modelValue"],
|
|
67
|
-
setup(F, { emit:
|
|
69
|
+
setup(F, { emit: C }) {
|
|
68
70
|
const a = F;
|
|
69
|
-
I.addI18n("zh_CN",
|
|
70
|
-
const
|
|
71
|
+
I.addI18n("zh_CN", fe);
|
|
72
|
+
const P = m(), u = m(), A = m(!1), U = m(!1), c = m({
|
|
71
73
|
dialogVisible: !1,
|
|
72
74
|
formData: {
|
|
73
75
|
images: []
|
|
74
76
|
}
|
|
75
|
-
}),
|
|
76
|
-
|
|
77
|
+
}), S = m(), q = () => {
|
|
78
|
+
c.value.dialogVisible = !1, c.value.formData = {
|
|
77
79
|
images: []
|
|
78
80
|
};
|
|
79
|
-
},
|
|
80
|
-
var
|
|
81
|
-
(
|
|
82
|
-
|
|
81
|
+
}, N = () => {
|
|
82
|
+
var o;
|
|
83
|
+
(o = S.value) == null || o.validate((l) => {
|
|
84
|
+
l && (c.value.formData.images.forEach((t) => {
|
|
83
85
|
var e;
|
|
84
|
-
(e =
|
|
85
|
-
}),
|
|
86
|
+
(e = u.value) == null || e.insertContent(`<img src=${t} alt="" />`);
|
|
87
|
+
}), c.value.dialogVisible = !1, c.value.formData.images = []);
|
|
86
88
|
});
|
|
87
|
-
}, r =
|
|
89
|
+
}, r = m({
|
|
88
90
|
dialogVisible: !1,
|
|
89
91
|
formData: {
|
|
90
92
|
// 名称
|
|
@@ -93,44 +95,48 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
93
95
|
cover: [],
|
|
94
96
|
// 文件
|
|
95
97
|
file: []
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
},
|
|
99
|
+
// 用于临时保存上传前的参数 { file: File }
|
|
100
|
+
additionalData: {}
|
|
101
|
+
}), k = m(), j = () => {
|
|
102
|
+
var o;
|
|
103
|
+
(o = k.value) == null || o.validate((l) => {
|
|
104
|
+
var t, e;
|
|
105
|
+
l && ((e = u.value) == null || e.insertContent(`<audio controls data-name="${r.value.formData.name}" data-poster="${r.value.formData.cover[0]}" src="${(t = r.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), r.value.dialogVisible = !1, r.value.formData = {
|
|
102
106
|
name: "",
|
|
103
107
|
cover: [],
|
|
104
108
|
file: []
|
|
105
|
-
});
|
|
109
|
+
}, r.value.additionalData = {});
|
|
106
110
|
});
|
|
107
111
|
}, G = () => {
|
|
108
112
|
r.value.dialogVisible = !1, r.value.formData = {
|
|
109
113
|
name: "",
|
|
110
114
|
cover: [],
|
|
111
115
|
file: []
|
|
112
|
-
};
|
|
113
|
-
},
|
|
116
|
+
}, r.value.additionalData = {};
|
|
117
|
+
}, s = m({
|
|
114
118
|
dialogVisible: !1,
|
|
115
119
|
formData: {
|
|
116
120
|
// 文件
|
|
117
121
|
file: []
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
},
|
|
123
|
+
// 用于临时保存上传前的参数 { file: File }
|
|
124
|
+
additionalData: {}
|
|
125
|
+
}), z = m(), L = () => {
|
|
126
|
+
var o;
|
|
127
|
+
(o = z.value) == null || o.validate((l) => {
|
|
128
|
+
var t, e;
|
|
129
|
+
l && ((e = u.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(t = s.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), s.value.dialogVisible = !1, s.value.formData = {
|
|
124
130
|
file: []
|
|
125
|
-
});
|
|
131
|
+
}, s.value.additionalData = {});
|
|
126
132
|
});
|
|
127
|
-
},
|
|
128
|
-
|
|
133
|
+
}, J = () => {
|
|
134
|
+
s.value.dialogVisible = !1, s.value.formData = {
|
|
129
135
|
file: []
|
|
130
|
-
};
|
|
131
|
-
},
|
|
136
|
+
}, s.value.additionalData = {};
|
|
137
|
+
}, K = (o, l) => new Promise(async (t, e) => {
|
|
132
138
|
var h;
|
|
133
|
-
const i = await
|
|
139
|
+
const i = await E(o, {
|
|
134
140
|
imageMaxSize: a.imageMaxSize,
|
|
135
141
|
imageAllowedMineType: a.imageAllowedMineType,
|
|
136
142
|
imageMinWidth: a.imageMinWidth,
|
|
@@ -140,39 +146,39 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
140
146
|
});
|
|
141
147
|
if (!i.success) {
|
|
142
148
|
e(), setTimeout(() => {
|
|
143
|
-
var p,
|
|
144
|
-
(p = i.error) != null && p.size ?
|
|
149
|
+
var p, f, _;
|
|
150
|
+
(p = i.error) != null && p.size ? l.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (f = i.error) != null && f.format ? l.onError(`请上传格式为${a.imageAllowedType.map((D) => D.toUpperCase()).join("、")}的图片`) : (_ = i.error) != null && _.pixel && l.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
|
|
145
151
|
});
|
|
146
152
|
return;
|
|
147
153
|
}
|
|
148
|
-
const
|
|
149
|
-
if (!
|
|
154
|
+
const n = await O(o);
|
|
155
|
+
if (!n.success) {
|
|
150
156
|
e(), setTimeout(() => {
|
|
151
|
-
|
|
157
|
+
l.onError(n.errorMessage);
|
|
152
158
|
});
|
|
153
159
|
return;
|
|
154
160
|
}
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
161
|
+
const d = await ((h = g.value) == null ? void 0 : h.call(g, n.file, o.name, { extParameters: a.extParameters }));
|
|
162
|
+
if (!d.success) {
|
|
157
163
|
e(), setTimeout(() => {
|
|
158
|
-
|
|
164
|
+
l.onError(d.errorMessage);
|
|
159
165
|
});
|
|
160
166
|
return;
|
|
161
167
|
}
|
|
162
|
-
|
|
168
|
+
t(d.url);
|
|
163
169
|
});
|
|
164
|
-
async function
|
|
165
|
-
var
|
|
166
|
-
const
|
|
167
|
-
for (let i of
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
(
|
|
170
|
+
async function H(o) {
|
|
171
|
+
var t, e;
|
|
172
|
+
const l = o.getElementsByTagName("img");
|
|
173
|
+
for (let i of l) {
|
|
174
|
+
const n = i.src;
|
|
175
|
+
if (n.startsWith("http://") || n.startsWith("https://")) {
|
|
176
|
+
const d = await ce(n);
|
|
177
|
+
if (d.width < a.imageMinWidth && d.height < a.imageMinHeight || d.width > a.imageMaxWidth && d.height > a.imageMaxHeight) {
|
|
178
|
+
(t = i == null ? void 0 : i.remove) == null || t.call(i);
|
|
173
179
|
return;
|
|
174
180
|
}
|
|
175
|
-
const h =
|
|
181
|
+
const h = n.split("."), p = h[h.length - 1].toLowerCase();
|
|
176
182
|
if (!a.imageAllowedType.includes(p)) {
|
|
177
183
|
(e = i == null ? void 0 : i.remove) == null || e.call(i);
|
|
178
184
|
return;
|
|
@@ -180,25 +186,25 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
188
|
}
|
|
183
|
-
const
|
|
189
|
+
const b = w(() => M([a.videoUploadOptions, x.videoUploadOptions]) || {}), y = w(() => M([a.audioUploadOptions, x.audioUploadOptions]) || {}), Q = w(() => M([a.imgPondOptions, x.imgPondOptions]) || {}), T = w(
|
|
184
190
|
() => M([a.paste_preprocess, x.paste_preprocess], {
|
|
185
191
|
type: Function
|
|
186
192
|
})
|
|
187
|
-
),
|
|
193
|
+
), V = w(
|
|
188
194
|
() => M([a.paste_postprocess, x.paste_postprocess], {
|
|
189
195
|
type: Function
|
|
190
196
|
})
|
|
191
|
-
),
|
|
197
|
+
), g = w(
|
|
192
198
|
() => M([a.imageUploadHandle, x.imageUploadHandle], {
|
|
193
199
|
type: Function
|
|
194
200
|
})
|
|
195
201
|
);
|
|
196
|
-
|
|
197
|
-
const
|
|
202
|
+
me(() => {
|
|
203
|
+
const o = {
|
|
198
204
|
// 设置语言
|
|
199
205
|
language: "zh_CN",
|
|
200
206
|
// 实例
|
|
201
|
-
target:
|
|
207
|
+
target: P.value,
|
|
202
208
|
// 隐藏品牌
|
|
203
209
|
branding: !1,
|
|
204
210
|
// 隐藏右上角升级按钮
|
|
@@ -253,12 +259,13 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
253
259
|
],
|
|
254
260
|
menu: {
|
|
255
261
|
insert: {
|
|
256
|
-
title: "
|
|
262
|
+
title: "插入",
|
|
257
263
|
items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
|
|
258
264
|
}
|
|
259
265
|
},
|
|
266
|
+
toolbar_mode: "sliding",
|
|
260
267
|
// 工具栏
|
|
261
|
-
toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
|
|
268
|
+
toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | localImage localAudio localVideo link anchor | ltr rtl",
|
|
262
269
|
// 改动后刷新,不再弹 alert
|
|
263
270
|
autosave_ask_before_unload: !1,
|
|
264
271
|
// 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
|
|
@@ -273,22 +280,22 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
273
280
|
paste_webkit_styles: "all",
|
|
274
281
|
paste_data_images: !0,
|
|
275
282
|
// 粘贴前处理
|
|
276
|
-
paste_preprocess(
|
|
283
|
+
paste_preprocess(t, e) {
|
|
277
284
|
var i;
|
|
278
|
-
e.content = e.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), e.content = e.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), e.content = e.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), e.content = e.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), e.content = e.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), e.content = e.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), e.content = e.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), e.content = e.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), e.content = e.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), e.content = e.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>"), (i =
|
|
285
|
+
e.content = e.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), e.content = e.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), e.content = e.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), e.content = e.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), e.content = e.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), e.content = e.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), e.content = e.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), e.content = e.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), e.content = e.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), e.content = e.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>"), (i = T.value) == null || i.call(T, t, e);
|
|
279
286
|
},
|
|
280
287
|
// 粘贴后处理(处理异步操作)
|
|
281
|
-
paste_postprocess(
|
|
282
|
-
var
|
|
288
|
+
paste_postprocess(t, e) {
|
|
289
|
+
var n;
|
|
283
290
|
const i = e.node;
|
|
284
|
-
|
|
291
|
+
H(i), (n = V.value) == null || n.call(V, t, e);
|
|
285
292
|
},
|
|
286
|
-
images_upload_handler(
|
|
293
|
+
images_upload_handler(t) {
|
|
287
294
|
return new Promise(async (e, i) => {
|
|
288
|
-
var
|
|
289
|
-
const
|
|
290
|
-
let
|
|
291
|
-
const h =
|
|
295
|
+
var D, W, $, B;
|
|
296
|
+
const n = ve.service({ text: "上传中" });
|
|
297
|
+
let d = t.blob();
|
|
298
|
+
const h = t.filename(), p = await E(d, {
|
|
292
299
|
imageMaxSize: a.imageMaxSize,
|
|
293
300
|
imageAllowedMineType: a.imageAllowedMineType,
|
|
294
301
|
imageMinWidth: a.imageMinWidth,
|
|
@@ -297,36 +304,46 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
297
304
|
imageMaxHeight: a.imageMaxHeight
|
|
298
305
|
});
|
|
299
306
|
if (!p.success) {
|
|
300
|
-
if (
|
|
307
|
+
if (n == null || n.close(), (D = p.error) != null && D.size)
|
|
301
308
|
return i({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
|
|
302
|
-
if ((
|
|
303
|
-
return i({ message: `请上传格式为${a.imageAllowedType.map((
|
|
304
|
-
if ((
|
|
309
|
+
if ((W = p.error) != null && W.format)
|
|
310
|
+
return i({ message: `请上传格式为${a.imageAllowedType.map((de) => de.toUpperCase()).join("、")}的图片`, remove: !0 });
|
|
311
|
+
if (($ = p.error) != null && $.pixel)
|
|
305
312
|
return i({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
|
|
306
313
|
}
|
|
307
|
-
const
|
|
308
|
-
if (!
|
|
309
|
-
return
|
|
310
|
-
if (!
|
|
311
|
-
return
|
|
312
|
-
const
|
|
313
|
-
if (!
|
|
314
|
-
return
|
|
315
|
-
|
|
314
|
+
const f = await O(d);
|
|
315
|
+
if (!f.success)
|
|
316
|
+
return n == null || n.close(), i({ message: f == null ? void 0 : f.errorMessage, remove: !0 });
|
|
317
|
+
if (!g.value)
|
|
318
|
+
return n == null || n.close(), i({ message: "缺少图片上传配置", remove: !0 });
|
|
319
|
+
const _ = await ((B = g.value) == null ? void 0 : B.call(g, f.file, h, { extParameters: a.extParameters }));
|
|
320
|
+
if (!_.success)
|
|
321
|
+
return n == null || n.close(), i({ message: _.errorMessage, remove: !0 });
|
|
322
|
+
n == null || n.close(), e(_.url);
|
|
316
323
|
});
|
|
317
324
|
},
|
|
318
|
-
setup(
|
|
319
|
-
|
|
325
|
+
setup(t) {
|
|
326
|
+
t.ui.registry.addMenuItem("localImage", {
|
|
320
327
|
text: "图片",
|
|
321
328
|
icon: "image",
|
|
322
329
|
onAction: () => {
|
|
323
|
-
|
|
330
|
+
c.value.dialogVisible = !0, setTimeout(() => {
|
|
324
331
|
var i;
|
|
325
332
|
const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
326
333
|
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
327
334
|
});
|
|
328
335
|
}
|
|
329
|
-
}),
|
|
336
|
+
}), t.ui.registry.addButton("localImage", {
|
|
337
|
+
icon: "image",
|
|
338
|
+
tooltip: "图片",
|
|
339
|
+
onAction: () => {
|
|
340
|
+
c.value.dialogVisible = !0, setTimeout(() => {
|
|
341
|
+
var i;
|
|
342
|
+
const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
343
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}), a.audioEnable && (t.ui.registry.addMenuItem("localAudio", {
|
|
330
347
|
text: "音频",
|
|
331
348
|
icon: "arrow-right",
|
|
332
349
|
onAction: () => {
|
|
@@ -336,97 +353,125 @@ const Qe = /* @__PURE__ */ ne({
|
|
|
336
353
|
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
337
354
|
});
|
|
338
355
|
}
|
|
339
|
-
}),
|
|
356
|
+
}), t.ui.registry.addButton("localAudio", {
|
|
357
|
+
icon: "arrow-right",
|
|
358
|
+
tooltip: "音频",
|
|
359
|
+
onAction: () => {
|
|
360
|
+
r.value.dialogVisible = !0, setTimeout(() => {
|
|
361
|
+
var i;
|
|
362
|
+
const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
363
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
})), a.videoEnable && (t.ui.registry.addMenuItem("localVideo", {
|
|
340
367
|
text: "视频",
|
|
341
368
|
icon: "embed",
|
|
342
369
|
onAction: () => {
|
|
343
|
-
|
|
370
|
+
s.value.dialogVisible = !0;
|
|
344
371
|
}
|
|
345
|
-
})
|
|
372
|
+
}), t.ui.registry.addButton("localVideo", {
|
|
373
|
+
icon: "embed",
|
|
374
|
+
tooltip: "视频",
|
|
375
|
+
onAction: () => {
|
|
376
|
+
s.value.dialogVisible = !0;
|
|
377
|
+
}
|
|
378
|
+
}));
|
|
346
379
|
}
|
|
347
|
-
},
|
|
380
|
+
}, l = M(
|
|
348
381
|
[
|
|
349
382
|
a.options,
|
|
350
383
|
x.tinymceOptions,
|
|
351
|
-
|
|
384
|
+
o
|
|
352
385
|
],
|
|
353
386
|
{
|
|
354
|
-
mergeFunction: (
|
|
355
|
-
|
|
387
|
+
mergeFunction: (t, e) => (...i) => {
|
|
388
|
+
t(...i), e(...i);
|
|
356
389
|
},
|
|
357
390
|
type: Object
|
|
358
391
|
}
|
|
359
392
|
);
|
|
360
|
-
I.init(
|
|
393
|
+
I.init(l).then(([t]) => {
|
|
361
394
|
var e;
|
|
362
|
-
|
|
363
|
-
if (
|
|
364
|
-
|
|
395
|
+
t && (t.customProps = { ...a }, t.on("change input Redo Undo SetContent", () => {
|
|
396
|
+
if (U.value) {
|
|
397
|
+
U.value = !1;
|
|
365
398
|
return;
|
|
366
399
|
}
|
|
367
|
-
|
|
368
|
-
}), (e = a.initComplete) == null || e.call(a, { editorIns:
|
|
400
|
+
A.value = !0, C("input", t.getContent()), C("update:modelValue", t.getContent());
|
|
401
|
+
}), (e = a.initComplete) == null || e.call(a, { editorIns: t }), u.value = t);
|
|
369
402
|
});
|
|
370
403
|
});
|
|
371
|
-
const
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
404
|
+
const X = () => {
|
|
405
|
+
var o, l;
|
|
406
|
+
return ((l = (o = y.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { file: r.value.additionalData, extParameters: a.extParameters })) || {};
|
|
407
|
+
}, Y = () => {
|
|
408
|
+
var o, l;
|
|
409
|
+
return ((l = (o = y.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { file: r.value.additionalData, extParameters: a.extParameters })) || {};
|
|
410
|
+
}, Z = (o, l, t) => {
|
|
411
|
+
var i, n;
|
|
412
|
+
const e = (n = (i = y == null ? void 0 : y.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
|
|
413
|
+
e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (v.error(e.errorMessage), t.splice(t.length - 1, 1)), r.value.formData.file = t;
|
|
414
|
+
}, ee = (o, l) => new Promise((t, e) => {
|
|
415
|
+
const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
377
416
|
if (!a.audioAllowedType.includes(i.toUpperCase())) {
|
|
378
|
-
|
|
417
|
+
v.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
|
|
379
418
|
return;
|
|
380
419
|
}
|
|
381
|
-
if (
|
|
382
|
-
|
|
420
|
+
if (o.size > a.audioMaxSize * 1024 * 1024) {
|
|
421
|
+
v.info(`请上传${a.audioMaxSize}M内的音频`), e();
|
|
383
422
|
return;
|
|
384
423
|
}
|
|
385
|
-
o(!0);
|
|
386
|
-
}),
|
|
387
|
-
r.value.formData.file =
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
var
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
424
|
+
r.value.additionalData = { file: o }, t(!0);
|
|
425
|
+
}), ae = (o, l) => {
|
|
426
|
+
r.value.formData.file = l;
|
|
427
|
+
}, oe = (o, l, t) => {
|
|
428
|
+
v.error("上传发生错误,请重试!"), r.value.formData.file = t;
|
|
429
|
+
}, ie = () => {
|
|
430
|
+
var o, l;
|
|
431
|
+
return ((l = (o = b.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { file: s.value.additionalData, extParameters: a.extParameters })) || {};
|
|
432
|
+
}, te = () => {
|
|
433
|
+
var o, l;
|
|
434
|
+
return ((l = (o = b.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { file: s.value.additionalData, extParameters: a.extParameters })) || {};
|
|
435
|
+
}, le = (o, l, t) => {
|
|
436
|
+
var i, n;
|
|
437
|
+
const e = (n = (i = b == null ? void 0 : b.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
|
|
438
|
+
e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (v.error(e.errorMessage), t.splice(t.length - 1, 1)), s.value.formData.file = t;
|
|
439
|
+
}, ne = (o, l) => new Promise((t, e) => {
|
|
440
|
+
const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
396
441
|
if (!a.videoAllowedType.includes(i.toUpperCase())) {
|
|
397
|
-
|
|
442
|
+
v.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
|
|
398
443
|
return;
|
|
399
444
|
}
|
|
400
|
-
if (
|
|
401
|
-
|
|
445
|
+
if (o.size > a.videoMaxSize * 1024 * 1024) {
|
|
446
|
+
v.info(`请上传${a.videoMaxSize}M内的视频`), e();
|
|
402
447
|
return;
|
|
403
448
|
}
|
|
404
|
-
o(!0);
|
|
405
|
-
}),
|
|
406
|
-
|
|
407
|
-
},
|
|
408
|
-
|
|
449
|
+
s.value.additionalData = { file: o }, t(!0);
|
|
450
|
+
}), re = (o, l) => {
|
|
451
|
+
s.value.formData.file = l;
|
|
452
|
+
}, se = (o, l, t) => {
|
|
453
|
+
v.error("上传发生错误,请重试!"), s.value.formData.file = t;
|
|
409
454
|
};
|
|
410
|
-
return
|
|
411
|
-
var
|
|
412
|
-
(
|
|
413
|
-
}),
|
|
414
|
-
var
|
|
415
|
-
(
|
|
416
|
-
}, { immediate: !0 }),
|
|
417
|
-
() => [a.value, a.modelValue,
|
|
455
|
+
return pe(() => {
|
|
456
|
+
var o;
|
|
457
|
+
(o = u.value) == null || o.destroy();
|
|
458
|
+
}), R(() => [a.disabled, u.value], () => {
|
|
459
|
+
var o, l;
|
|
460
|
+
(l = (o = u.value) == null ? void 0 : o.mode) == null || l.set(a.disabled ? "readonly" : "design");
|
|
461
|
+
}, { immediate: !0 }), R(
|
|
462
|
+
() => [a.value, a.modelValue, u.value],
|
|
418
463
|
() => {
|
|
419
|
-
var
|
|
420
|
-
if (
|
|
421
|
-
|
|
464
|
+
var o;
|
|
465
|
+
if (A.value) {
|
|
466
|
+
A.value = !1;
|
|
422
467
|
return;
|
|
423
468
|
}
|
|
424
|
-
|
|
469
|
+
U.value = !0, (o = u.value) == null || o.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
|
|
425
470
|
},
|
|
426
471
|
{ immediate: !0 }
|
|
427
|
-
), { __sfc: !0, insRef:
|
|
472
|
+
), { __sfc: !0, insRef: P, editorRef: u, preventSettingContent: A, preventUpdatingModelValue: U, uploadImage: c, uploadImageFormRef: S, onUploadImageClose: q, onUploadImageConfirm: N, uploadAudio: r, uploadAudioFormRef: k, onUploadAudioConfirm: j, onUploadAudioClose: G, uploadVideo: s, uploadVideoFormRef: z, onUploadVideoConfirm: L, onUploadVideoClose: J, onImageUploadUpload: K, props: a, emits: C, processPastedImage: H, mergeVideoUploadOptions: b, mergeAudioUploadOptions: y, mergeImgPondOptions: Q, paste_preprocess: T, paste_postprocess: V, imageUploadHandle: g, getUploadAudioData: X, getUploadAudioHeaders: Y, onUploadAudioSuccess: Z, onUploadAudioBeforeUpload: ee, onUploadAudioRemove: ae, onUploadAudioError: oe, getUploadVideoData: ie, getUploadVideoHeaders: te, onUploadVideoSuccess: le, onUploadVideoBeforeUpload: ne, onUploadVideoRemove: re, onUploadVideoError: se, ImgPond: ge };
|
|
428
473
|
}
|
|
429
474
|
});
|
|
430
475
|
export {
|
|
431
|
-
|
|
476
|
+
Ze as default
|
|
432
477
|
};
|
package/es/index.d.ts
CHANGED
|
@@ -29,8 +29,14 @@ interface TinymceEditorGlobalOptions {
|
|
|
29
29
|
url?: string;
|
|
30
30
|
errorMessage?: string;
|
|
31
31
|
};
|
|
32
|
-
headers?:
|
|
33
|
-
|
|
32
|
+
headers?: (parameters: {
|
|
33
|
+
file: File | Blob;
|
|
34
|
+
extParameters: Record<string, any>;
|
|
35
|
+
}) => Record<string, any>;
|
|
36
|
+
data?: (parameters: {
|
|
37
|
+
file: File | Blob;
|
|
38
|
+
extParameters: Record<string, any>;
|
|
39
|
+
}) => Record<string, any>;
|
|
34
40
|
};
|
|
35
41
|
/** 视频上传选项 */
|
|
36
42
|
videoUploadOptions?: {
|
|
@@ -39,8 +45,14 @@ interface TinymceEditorGlobalOptions {
|
|
|
39
45
|
url?: string;
|
|
40
46
|
errorMessage?: string;
|
|
41
47
|
};
|
|
42
|
-
headers?:
|
|
43
|
-
|
|
48
|
+
headers?: (parameters: {
|
|
49
|
+
file: File | Blob;
|
|
50
|
+
extParameters: Record<string, any>;
|
|
51
|
+
}) => Record<string, any>;
|
|
52
|
+
data?: (parameters: {
|
|
53
|
+
file: File | Blob;
|
|
54
|
+
extParameters: Record<string, any>;
|
|
55
|
+
}) => Record<string, any>;
|
|
44
56
|
};
|
|
45
57
|
}
|
|
46
58
|
declare const globalProps: TinymceEditorGlobalOptions;
|
|
@@ -95,6 +107,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
95
107
|
type: import('vue').PropType<string[]>;
|
|
96
108
|
default: () => string[];
|
|
97
109
|
};
|
|
110
|
+
audioEnable: {
|
|
111
|
+
type: import('vue').PropType<boolean>;
|
|
112
|
+
default: boolean;
|
|
113
|
+
};
|
|
98
114
|
audioMaxSize: {
|
|
99
115
|
type: import('vue').PropType<number>;
|
|
100
116
|
default: number;
|
|
@@ -110,10 +126,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
110
126
|
url?: string | undefined;
|
|
111
127
|
errorMessage?: string | undefined;
|
|
112
128
|
};
|
|
113
|
-
headers?:
|
|
114
|
-
|
|
129
|
+
headers?: ((parameters: {
|
|
130
|
+
file: File | Blob;
|
|
131
|
+
extParameters: Record<string, any>;
|
|
132
|
+
}) => Record<string, any>) | undefined;
|
|
133
|
+
data?: ((parameters: {
|
|
134
|
+
file: File | Blob;
|
|
135
|
+
extParameters: Record<string, any>;
|
|
136
|
+
}) => Record<string, any>) | undefined;
|
|
115
137
|
}>;
|
|
116
138
|
};
|
|
139
|
+
videoEnable: {
|
|
140
|
+
type: import('vue').PropType<boolean>;
|
|
141
|
+
default: boolean;
|
|
142
|
+
};
|
|
117
143
|
videoMaxSize: {
|
|
118
144
|
type: import('vue').PropType<number>;
|
|
119
145
|
default: number;
|
|
@@ -129,8 +155,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
129
155
|
url?: string | undefined;
|
|
130
156
|
errorMessage?: string | undefined;
|
|
131
157
|
};
|
|
132
|
-
headers?:
|
|
133
|
-
|
|
158
|
+
headers?: ((parameters: {
|
|
159
|
+
file: File | Blob;
|
|
160
|
+
extParameters: {};
|
|
161
|
+
}) => Record<string, any>) | undefined;
|
|
162
|
+
data?: ((parameters: {
|
|
163
|
+
file: File | Blob;
|
|
164
|
+
extParameters: {};
|
|
165
|
+
}) => Record<string, any>) | undefined;
|
|
134
166
|
}>;
|
|
135
167
|
};
|
|
136
168
|
imageUploadHandle: {
|
|
@@ -217,6 +249,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
217
249
|
type: import('vue').PropType<string[]>;
|
|
218
250
|
default: () => string[];
|
|
219
251
|
};
|
|
252
|
+
audioEnable: {
|
|
253
|
+
type: import('vue').PropType<boolean>;
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
220
256
|
audioMaxSize: {
|
|
221
257
|
type: import('vue').PropType<number>;
|
|
222
258
|
default: number;
|
|
@@ -232,10 +268,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
232
268
|
url?: string | undefined;
|
|
233
269
|
errorMessage?: string | undefined;
|
|
234
270
|
};
|
|
235
|
-
headers?:
|
|
236
|
-
|
|
271
|
+
headers?: ((parameters: {
|
|
272
|
+
file: File | Blob;
|
|
273
|
+
extParameters: Record<string, any>;
|
|
274
|
+
}) => Record<string, any>) | undefined;
|
|
275
|
+
data?: ((parameters: {
|
|
276
|
+
file: File | Blob;
|
|
277
|
+
extParameters: Record<string, any>;
|
|
278
|
+
}) => Record<string, any>) | undefined;
|
|
237
279
|
}>;
|
|
238
280
|
};
|
|
281
|
+
videoEnable: {
|
|
282
|
+
type: import('vue').PropType<boolean>;
|
|
283
|
+
default: boolean;
|
|
284
|
+
};
|
|
239
285
|
videoMaxSize: {
|
|
240
286
|
type: import('vue').PropType<number>;
|
|
241
287
|
default: number;
|
|
@@ -251,8 +297,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
251
297
|
url?: string | undefined;
|
|
252
298
|
errorMessage?: string | undefined;
|
|
253
299
|
};
|
|
254
|
-
headers?:
|
|
255
|
-
|
|
300
|
+
headers?: ((parameters: {
|
|
301
|
+
file: File | Blob;
|
|
302
|
+
extParameters: {};
|
|
303
|
+
}) => Record<string, any>) | undefined;
|
|
304
|
+
data?: ((parameters: {
|
|
305
|
+
file: File | Blob;
|
|
306
|
+
extParameters: {};
|
|
307
|
+
}) => Record<string, any>) | undefined;
|
|
256
308
|
}>;
|
|
257
309
|
};
|
|
258
310
|
imageUploadHandle: {
|
|
@@ -303,8 +355,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
303
355
|
imageUploadMaxCount: number;
|
|
304
356
|
imageUploadTip: string;
|
|
305
357
|
imageAllowedType: string[];
|
|
358
|
+
audioEnable: boolean;
|
|
306
359
|
audioMaxSize: number;
|
|
307
360
|
audioAllowedType: string[];
|
|
361
|
+
videoEnable: boolean;
|
|
308
362
|
videoMaxSize: number;
|
|
309
363
|
videoAllowedType: string[];
|
|
310
364
|
options: Partial<RawEditorOptions>;
|
|
@@ -359,6 +413,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
359
413
|
type: import('vue').PropType<string[]>;
|
|
360
414
|
default: () => string[];
|
|
361
415
|
};
|
|
416
|
+
audioEnable: {
|
|
417
|
+
type: import('vue').PropType<boolean>;
|
|
418
|
+
default: boolean;
|
|
419
|
+
};
|
|
362
420
|
audioMaxSize: {
|
|
363
421
|
type: import('vue').PropType<number>;
|
|
364
422
|
default: number;
|
|
@@ -374,10 +432,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
374
432
|
url?: string | undefined;
|
|
375
433
|
errorMessage?: string | undefined;
|
|
376
434
|
};
|
|
377
|
-
headers?:
|
|
378
|
-
|
|
435
|
+
headers?: ((parameters: {
|
|
436
|
+
file: File | Blob;
|
|
437
|
+
extParameters: Record<string, any>;
|
|
438
|
+
}) => Record<string, any>) | undefined;
|
|
439
|
+
data?: ((parameters: {
|
|
440
|
+
file: File | Blob;
|
|
441
|
+
extParameters: Record<string, any>;
|
|
442
|
+
}) => Record<string, any>) | undefined;
|
|
379
443
|
}>;
|
|
380
444
|
};
|
|
445
|
+
videoEnable: {
|
|
446
|
+
type: import('vue').PropType<boolean>;
|
|
447
|
+
default: boolean;
|
|
448
|
+
};
|
|
381
449
|
videoMaxSize: {
|
|
382
450
|
type: import('vue').PropType<number>;
|
|
383
451
|
default: number;
|
|
@@ -393,8 +461,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
393
461
|
url?: string | undefined;
|
|
394
462
|
errorMessage?: string | undefined;
|
|
395
463
|
};
|
|
396
|
-
headers?:
|
|
397
|
-
|
|
464
|
+
headers?: ((parameters: {
|
|
465
|
+
file: File | Blob;
|
|
466
|
+
extParameters: {};
|
|
467
|
+
}) => Record<string, any>) | undefined;
|
|
468
|
+
data?: ((parameters: {
|
|
469
|
+
file: File | Blob;
|
|
470
|
+
extParameters: {};
|
|
471
|
+
}) => Record<string, any>) | undefined;
|
|
398
472
|
}>;
|
|
399
473
|
};
|
|
400
474
|
imageUploadHandle: {
|
|
@@ -481,6 +555,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
481
555
|
type: import('vue').PropType<string[]>;
|
|
482
556
|
default: () => string[];
|
|
483
557
|
};
|
|
558
|
+
audioEnable: {
|
|
559
|
+
type: import('vue').PropType<boolean>;
|
|
560
|
+
default: boolean;
|
|
561
|
+
};
|
|
484
562
|
audioMaxSize: {
|
|
485
563
|
type: import('vue').PropType<number>;
|
|
486
564
|
default: number;
|
|
@@ -496,10 +574,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
496
574
|
url?: string | undefined;
|
|
497
575
|
errorMessage?: string | undefined;
|
|
498
576
|
};
|
|
499
|
-
headers?:
|
|
500
|
-
|
|
577
|
+
headers?: ((parameters: {
|
|
578
|
+
file: File | Blob;
|
|
579
|
+
extParameters: Record<string, any>;
|
|
580
|
+
}) => Record<string, any>) | undefined;
|
|
581
|
+
data?: ((parameters: {
|
|
582
|
+
file: File | Blob;
|
|
583
|
+
extParameters: Record<string, any>;
|
|
584
|
+
}) => Record<string, any>) | undefined;
|
|
501
585
|
}>;
|
|
502
586
|
};
|
|
587
|
+
videoEnable: {
|
|
588
|
+
type: import('vue').PropType<boolean>;
|
|
589
|
+
default: boolean;
|
|
590
|
+
};
|
|
503
591
|
videoMaxSize: {
|
|
504
592
|
type: import('vue').PropType<number>;
|
|
505
593
|
default: number;
|
|
@@ -515,8 +603,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
515
603
|
url?: string | undefined;
|
|
516
604
|
errorMessage?: string | undefined;
|
|
517
605
|
};
|
|
518
|
-
headers?:
|
|
519
|
-
|
|
606
|
+
headers?: ((parameters: {
|
|
607
|
+
file: File | Blob;
|
|
608
|
+
extParameters: {};
|
|
609
|
+
}) => Record<string, any>) | undefined;
|
|
610
|
+
data?: ((parameters: {
|
|
611
|
+
file: File | Blob;
|
|
612
|
+
extParameters: {};
|
|
613
|
+
}) => Record<string, any>) | undefined;
|
|
520
614
|
}>;
|
|
521
615
|
};
|
|
522
616
|
imageUploadHandle: {
|
|
@@ -603,6 +697,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
603
697
|
type: import('vue').PropType<string[]>;
|
|
604
698
|
default: () => string[];
|
|
605
699
|
};
|
|
700
|
+
audioEnable: {
|
|
701
|
+
type: import('vue').PropType<boolean>;
|
|
702
|
+
default: boolean;
|
|
703
|
+
};
|
|
606
704
|
audioMaxSize: {
|
|
607
705
|
type: import('vue').PropType<number>;
|
|
608
706
|
default: number;
|
|
@@ -618,10 +716,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
618
716
|
url?: string | undefined;
|
|
619
717
|
errorMessage?: string | undefined;
|
|
620
718
|
};
|
|
621
|
-
headers?:
|
|
622
|
-
|
|
719
|
+
headers?: ((parameters: {
|
|
720
|
+
file: File | Blob;
|
|
721
|
+
extParameters: Record<string, any>;
|
|
722
|
+
}) => Record<string, any>) | undefined;
|
|
723
|
+
data?: ((parameters: {
|
|
724
|
+
file: File | Blob;
|
|
725
|
+
extParameters: Record<string, any>;
|
|
726
|
+
}) => Record<string, any>) | undefined;
|
|
623
727
|
}>;
|
|
624
728
|
};
|
|
729
|
+
videoEnable: {
|
|
730
|
+
type: import('vue').PropType<boolean>;
|
|
731
|
+
default: boolean;
|
|
732
|
+
};
|
|
625
733
|
videoMaxSize: {
|
|
626
734
|
type: import('vue').PropType<number>;
|
|
627
735
|
default: number;
|
|
@@ -637,8 +745,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
637
745
|
url?: string | undefined;
|
|
638
746
|
errorMessage?: string | undefined;
|
|
639
747
|
};
|
|
640
|
-
headers?:
|
|
641
|
-
|
|
748
|
+
headers?: ((parameters: {
|
|
749
|
+
file: File | Blob;
|
|
750
|
+
extParameters: {};
|
|
751
|
+
}) => Record<string, any>) | undefined;
|
|
752
|
+
data?: ((parameters: {
|
|
753
|
+
file: File | Blob;
|
|
754
|
+
extParameters: {};
|
|
755
|
+
}) => Record<string, any>) | undefined;
|
|
642
756
|
}>;
|
|
643
757
|
};
|
|
644
758
|
imageUploadHandle: {
|
|
@@ -689,8 +803,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
689
803
|
imageUploadMaxCount: number;
|
|
690
804
|
imageUploadTip: string;
|
|
691
805
|
imageAllowedType: string[];
|
|
806
|
+
audioEnable: boolean;
|
|
692
807
|
audioMaxSize: number;
|
|
693
808
|
audioAllowedType: string[];
|
|
809
|
+
videoEnable: boolean;
|
|
694
810
|
videoMaxSize: number;
|
|
695
811
|
videoAllowedType: string[];
|
|
696
812
|
options: Partial<RawEditorOptions>;
|
|
@@ -746,6 +862,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
746
862
|
type: import('vue').PropType<string[]>;
|
|
747
863
|
default: () => string[];
|
|
748
864
|
};
|
|
865
|
+
audioEnable: {
|
|
866
|
+
type: import('vue').PropType<boolean>;
|
|
867
|
+
default: boolean;
|
|
868
|
+
};
|
|
749
869
|
audioMaxSize: {
|
|
750
870
|
type: import('vue').PropType<number>;
|
|
751
871
|
default: number;
|
|
@@ -761,10 +881,20 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
761
881
|
url?: string | undefined;
|
|
762
882
|
errorMessage?: string | undefined;
|
|
763
883
|
};
|
|
764
|
-
headers?:
|
|
765
|
-
|
|
884
|
+
headers?: ((parameters: {
|
|
885
|
+
file: File | Blob;
|
|
886
|
+
extParameters: Record<string, any>;
|
|
887
|
+
}) => Record<string, any>) | undefined;
|
|
888
|
+
data?: ((parameters: {
|
|
889
|
+
file: File | Blob;
|
|
890
|
+
extParameters: Record<string, any>;
|
|
891
|
+
}) => Record<string, any>) | undefined;
|
|
766
892
|
}>;
|
|
767
893
|
};
|
|
894
|
+
videoEnable: {
|
|
895
|
+
type: import('vue').PropType<boolean>;
|
|
896
|
+
default: boolean;
|
|
897
|
+
};
|
|
768
898
|
videoMaxSize: {
|
|
769
899
|
type: import('vue').PropType<number>;
|
|
770
900
|
default: number;
|
|
@@ -780,8 +910,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
780
910
|
url?: string | undefined;
|
|
781
911
|
errorMessage?: string | undefined;
|
|
782
912
|
};
|
|
783
|
-
headers?:
|
|
784
|
-
|
|
913
|
+
headers?: ((parameters: {
|
|
914
|
+
file: File | Blob;
|
|
915
|
+
extParameters: {};
|
|
916
|
+
}) => Record<string, any>) | undefined;
|
|
917
|
+
data?: ((parameters: {
|
|
918
|
+
file: File | Blob;
|
|
919
|
+
extParameters: {};
|
|
920
|
+
}) => Record<string, any>) | undefined;
|
|
785
921
|
}>;
|
|
786
922
|
};
|
|
787
923
|
imageUploadHandle: {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -26,15 +26,15 @@ interface TinymceEditorGlobalOptions {
|
|
|
26
26
|
audioUploadOptions?: {
|
|
27
27
|
action: string;
|
|
28
28
|
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
29
|
-
headers?: Record<string, any>;
|
|
30
|
-
data?: Record<string, any>;
|
|
29
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
30
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
31
31
|
},
|
|
32
32
|
/** 视频上传选项 */
|
|
33
33
|
videoUploadOptions?: {
|
|
34
34
|
action: string;
|
|
35
35
|
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
36
|
-
headers?: Record<string, any>;
|
|
37
|
-
data?: Record<string, any>;
|
|
36
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
37
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|