@keyblade/tinymce-editor-vue2 1.2.1 → 1.2.3
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/es/editor.vue2.js +139 -136
- package/es/types.d.ts +8 -2
- package/package.json +1 -1
package/es/editor.vue2.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
var Be = Object.defineProperty, Ve = Object.defineProperties;
|
|
2
2
|
var je = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var ue = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
5
|
-
var ce = (
|
|
6
|
-
var me = (
|
|
7
|
-
for (var i in
|
|
8
|
-
|
|
4
|
+
var Re = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ce = (c, s) => (s = Symbol[c]) ? s : Symbol.for("Symbol." + c);
|
|
6
|
+
var me = (c, s, i) => s in c ? Be(c, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : c[s] = i, D = (c, s) => {
|
|
7
|
+
for (var i in s || (s = {}))
|
|
8
|
+
Re.call(s, i) && me(c, i, s[i]);
|
|
9
9
|
if (ue)
|
|
10
|
-
for (var i of ue(
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
}, B = (
|
|
14
|
-
var
|
|
10
|
+
for (var i of ue(s))
|
|
11
|
+
He.call(s, i) && me(c, i, s[i]);
|
|
12
|
+
return c;
|
|
13
|
+
}, B = (c, s) => Ve(c, je(s));
|
|
14
|
+
var F = (c, s, i) => new Promise((O, T) => {
|
|
15
15
|
var P = (g) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
m(i.next(g));
|
|
18
18
|
} catch (I) {
|
|
19
19
|
T(I);
|
|
20
20
|
}
|
|
21
21
|
}, V = (g) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
23
|
+
m(i.throw(g));
|
|
24
24
|
} catch (I) {
|
|
25
25
|
T(I);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, m = (g) => g.done ? O(g.value) : Promise.resolve(g.value).then(P, V);
|
|
28
|
+
m((i = i.apply(c, s)).next());
|
|
29
29
|
});
|
|
30
|
-
var G = (
|
|
31
|
-
import { defineComponent as
|
|
30
|
+
var G = (c, s, i) => (s = c[ce("asyncIterator")]) ? s.call(c) : (c = c[ce("iterator")](), s = {}, i = (O, T) => (T = c[O]) && (s[O] = (P) => new Promise((V, m, g) => (P = T.call(c, P), g = P.done, Promise.resolve(P.value).then((I) => V({ value: I, done: g }), m)))), i("next"), i("return"), s);
|
|
31
|
+
import { defineComponent as $e, ref as A, computed as X, onMounted as Ee, onUnmounted as qe, watch as de } from "vue";
|
|
32
32
|
import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We, blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "@keyblade/one-travel";
|
|
33
33
|
/* empty css */
|
|
34
|
-
import { conclude as
|
|
34
|
+
import { conclude as W } from "vue-global-config";
|
|
35
35
|
import pe from "tinymce";
|
|
36
36
|
import Xe from "./langs/zh_CN.js";
|
|
37
37
|
import "tinymce/skins/ui/oxide/skin";
|
|
@@ -64,10 +64,10 @@ import "tinymce/plugins/table";
|
|
|
64
64
|
import "tinymce/plugins/visualblocks";
|
|
65
65
|
import "tinymce/plugins/visualchars";
|
|
66
66
|
import "tinymce/plugins/wordcount";
|
|
67
|
-
import { globalProps as
|
|
67
|
+
import { globalProps as N } from "./index.js";
|
|
68
68
|
import { Message as b } from "element-ui";
|
|
69
69
|
import { defaultImageUploadOptions as S, EImageUploadInnerBeforeUploadStep as Je } from "@keyblade/pro-components-vue2";
|
|
70
|
-
const
|
|
70
|
+
const Ra = /* @__PURE__ */ $e({
|
|
71
71
|
__name: "editor",
|
|
72
72
|
props: {
|
|
73
73
|
value: { default: "" },
|
|
@@ -80,8 +80,8 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
80
80
|
initComplete: null
|
|
81
81
|
},
|
|
82
82
|
emits: ["input"],
|
|
83
|
-
setup(
|
|
84
|
-
const i =
|
|
83
|
+
setup(c, { emit: s }) {
|
|
84
|
+
const i = c;
|
|
85
85
|
pe.addI18n("zh_CN", Xe);
|
|
86
86
|
const O = {
|
|
87
87
|
name: S.name,
|
|
@@ -105,24 +105,24 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
105
105
|
maxSize: 200,
|
|
106
106
|
allowedType: ["wav", "mp3", "mp4", "m4a", "wma", "aac"],
|
|
107
107
|
accept: ".wav,.mp3,.mp4,.m4a,.wma,.aac"
|
|
108
|
-
}, V = A(),
|
|
108
|
+
}, V = A(), m = A(), g = A(!1), I = A(!1), H = A({
|
|
109
109
|
show: !1,
|
|
110
110
|
text: "图片上传中,请稍等"
|
|
111
|
-
}), p = X(() =>
|
|
111
|
+
}), p = X(() => W([i.imageUploadOptions, N.imageUploadOptions, O]) || {}), u = X(() => W([i.videoUploadOptions, N.videoUploadOptions, T]) || {}), v = X(() => W([i.audioUploadOptions, N.audioUploadOptions, P]) || {}), $ = A({
|
|
112
112
|
dialogVisible: !1,
|
|
113
113
|
formData: {
|
|
114
114
|
images: []
|
|
115
115
|
}
|
|
116
116
|
}), j = A(), J = A(), K = () => {
|
|
117
|
-
|
|
117
|
+
$.value.dialogVisible = !1, $.value.formData = {
|
|
118
118
|
images: []
|
|
119
119
|
}, j.value = void 0;
|
|
120
120
|
}, fe = () => {
|
|
121
121
|
var o;
|
|
122
122
|
(o = J.value) == null || o.validate((e) => {
|
|
123
|
-
e && (
|
|
124
|
-
var
|
|
125
|
-
(
|
|
123
|
+
e && ($.value.formData.images.forEach((a) => {
|
|
124
|
+
var l;
|
|
125
|
+
(l = m.value) == null || l.insertContent(`<img src=${a == null ? void 0 : a.url} alt="" />`);
|
|
126
126
|
}), K());
|
|
127
127
|
});
|
|
128
128
|
}, w = A({
|
|
@@ -146,8 +146,8 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
146
146
|
}, ve = () => {
|
|
147
147
|
var o;
|
|
148
148
|
(o = Q.value) == null || o.validate((e) => {
|
|
149
|
-
var a,
|
|
150
|
-
e && ((
|
|
149
|
+
var a, l;
|
|
150
|
+
e && ((l = m.value) == null || l.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${w.value.formData.name}" data-poster="${w.value.formData.cover[0]}" src="${(a = w.value.formData.file[0]) == null ? void 0 : a.url}"></audio>`), Y());
|
|
151
151
|
});
|
|
152
152
|
}, _ = A({
|
|
153
153
|
dialogVisible: !1,
|
|
@@ -164,15 +164,15 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
164
164
|
}, ge = () => {
|
|
165
165
|
var o;
|
|
166
166
|
(o = Z.value) == null || o.validate((e) => {
|
|
167
|
-
var a,
|
|
168
|
-
e && ((
|
|
167
|
+
var a, l;
|
|
168
|
+
e && ((l = m.value) == null || l.insertContent(`<video width="auto" height="auto" controls src="${(a = _.value.formData.file[0]) == null ? void 0 : a.url}"></video>`), ee());
|
|
169
169
|
});
|
|
170
170
|
};
|
|
171
171
|
function ae(o) {
|
|
172
|
-
return
|
|
173
|
-
var
|
|
172
|
+
return F(this, null, function* () {
|
|
173
|
+
var r, d, y, f, C, h, U, M, E;
|
|
174
174
|
let e = o;
|
|
175
|
-
if (!((
|
|
175
|
+
if (!((r = p.value) != null && r.handleRequest)) {
|
|
176
176
|
b.error("缺少图片上传配置");
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
@@ -181,7 +181,7 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
181
181
|
b.error("不允许粘贴");
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
const
|
|
184
|
+
const l = yield Fe(e, a, {
|
|
185
185
|
imageMaxSize: (d = p.value.checkOptions) == null ? void 0 : d.maxSize,
|
|
186
186
|
imageAllowedType: (y = p.value.checkOptions) == null ? void 0 : y.allowedType,
|
|
187
187
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
@@ -190,86 +190,86 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
190
190
|
imageMaxWidth: (h = p.value.checkOptions) == null ? void 0 : h.maxWidth,
|
|
191
191
|
imageMaxHeight: (U = p.value.checkOptions) == null ? void 0 : U.maxHeight
|
|
192
192
|
});
|
|
193
|
-
if (!
|
|
194
|
-
b.error((
|
|
193
|
+
if (!l.success) {
|
|
194
|
+
b.error((l == null ? void 0 : l.errorMessage) || "");
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
|
-
if (
|
|
198
|
-
e =
|
|
197
|
+
if (l.hasTransform) {
|
|
198
|
+
e = l.file;
|
|
199
199
|
const ie = a == null ? void 0 : a.split(".");
|
|
200
200
|
ie.pop(), a = `${ie.join(",")}.jpg`;
|
|
201
201
|
}
|
|
202
|
-
const
|
|
203
|
-
if (!
|
|
204
|
-
b.error((
|
|
202
|
+
const n = yield We(e);
|
|
203
|
+
if (!n.success) {
|
|
204
|
+
b.error((n == null ? void 0 : n.errorMessage) || "压缩失败");
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
209
|
-
b.error((
|
|
207
|
+
const t = yield (E = (M = p.value).handleRequest) == null ? void 0 : E.call(M, Ne(n.file, a), a, { extParameters: i.extParameters });
|
|
208
|
+
if (!t || !t.success) {
|
|
209
|
+
b.error((t == null ? void 0 : t.errorMessage) || "");
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
return
|
|
212
|
+
return t.url;
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
-
const
|
|
216
|
-
var
|
|
217
|
-
const e =
|
|
215
|
+
const L = (o) => F(this, null, function* () {
|
|
216
|
+
var t, r, d, y, f, C, h, U, M, E, le, ne, re;
|
|
217
|
+
const e = m.value, a = o.types;
|
|
218
218
|
if (a.includes("text/html")) {
|
|
219
|
-
const z = o.getData("text/html"),
|
|
220
|
-
se.length > 0 && (
|
|
219
|
+
const z = o.getData("text/html"), R = new DOMParser().parseFromString(z, "text/html"), se = Array.from(R.body.querySelectorAll("img")), Te = Array.from(R.body.querySelectorAll("audio")), ze = Array.from(R.body.querySelectorAll("video"));
|
|
220
|
+
se.length > 0 && (H.value = {
|
|
221
221
|
show: !0,
|
|
222
222
|
text: "图片加载中,请稍等"
|
|
223
223
|
});
|
|
224
224
|
for (const k of [...Te, ...ze])
|
|
225
225
|
k == null || k.remove();
|
|
226
226
|
try {
|
|
227
|
-
for (var ie = G([...se]), Ke,
|
|
228
|
-
const k =
|
|
227
|
+
for (var ie = G([...se]), Ke, Ea, qa; Ke = !(Ea = yield ie.next()).done; Ke = !1) {
|
|
228
|
+
const k = Ea.value;
|
|
229
229
|
if (k.removeAttribute("crossorigin"), k.src.startsWith("http"))
|
|
230
|
-
if ((
|
|
231
|
-
const x = yield (
|
|
230
|
+
if ((t = p.value) != null && t.handleRequestByUrl) {
|
|
231
|
+
const x = yield (r = p.value) == null ? void 0 : r.handleRequestByUrl(k.src, { extParameters: i.extParameters });
|
|
232
232
|
x != null && x.success && (x != null && x.url) ? k.src = x == null ? void 0 : x.url : k.remove();
|
|
233
233
|
} else {
|
|
234
234
|
const x = yield Le(k.src);
|
|
235
|
-
x && (x.width < (((y = (d = p.value) == null ? void 0 : d.checkOptions) == null ? void 0 : y.minWidth) || 0) && x.height < (((C = (f = p.value) == null ? void 0 : f.checkOptions) == null ? void 0 : C.minHeight) || 0) || x.width > (((U = (h = p.value) == null ? void 0 : h.checkOptions) == null ? void 0 : U.maxWidth) || 0) && x.height > (((
|
|
235
|
+
x && (x.width < (((y = (d = p.value) == null ? void 0 : d.checkOptions) == null ? void 0 : y.minWidth) || 0) && x.height < (((C = (f = p.value) == null ? void 0 : f.checkOptions) == null ? void 0 : C.minHeight) || 0) || x.width > (((U = (h = p.value) == null ? void 0 : h.checkOptions) == null ? void 0 : U.maxWidth) || 0) && x.height > (((E = (M = p.value) == null ? void 0 : M.checkOptions) == null ? void 0 : E.maxHeight) || 0)) && k.remove();
|
|
236
236
|
}
|
|
237
237
|
else
|
|
238
238
|
k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
239
239
|
}
|
|
240
|
-
} catch (
|
|
241
|
-
qa = [
|
|
240
|
+
} catch (Ea) {
|
|
241
|
+
qa = [Ea];
|
|
242
242
|
} finally {
|
|
243
243
|
try {
|
|
244
|
-
Ke && (
|
|
244
|
+
Ke && (Ea = ie.return) && (yield Ea.call(ie));
|
|
245
245
|
} finally {
|
|
246
246
|
if (qa)
|
|
247
247
|
throw qa[0];
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
const Oe = new XMLSerializer().serializeToString(
|
|
250
|
+
H.value.show = !1;
|
|
251
|
+
const Oe = new XMLSerializer().serializeToString(R.body);
|
|
252
252
|
e.insertContent(Oe);
|
|
253
253
|
} else a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
|
|
254
|
-
const
|
|
255
|
-
for (const z of
|
|
254
|
+
const l = Array.from((o == null ? void 0 : o.files) || []), n = [];
|
|
255
|
+
for (const z of l) {
|
|
256
256
|
if (!z)
|
|
257
257
|
continue;
|
|
258
258
|
const q = Ge(z.name);
|
|
259
|
-
z.type.indexOf("image") > -1 || (re = (ne = (le = p.value) == null ? void 0 : le.checkOptions) == null ? void 0 : ne.allowedType) != null && re.includes(q.toLowerCase()) ?
|
|
259
|
+
z.type.indexOf("image") > -1 || (re = (ne = (le = p.value) == null ? void 0 : le.checkOptions) == null ? void 0 : ne.allowedType) != null && re.includes(q.toLowerCase()) ? n.push(z) : b.error("暂不支持的文件类型");
|
|
260
260
|
}
|
|
261
|
-
if (
|
|
262
|
-
|
|
261
|
+
if (n.length > 0) {
|
|
262
|
+
H.value = {
|
|
263
263
|
show: !0,
|
|
264
264
|
text: "图片上传中,请稍等"
|
|
265
265
|
};
|
|
266
266
|
try {
|
|
267
|
-
for (var Fa = G(
|
|
267
|
+
for (var Fa = G(n), Wa, Na, La; Wa = !(Na = yield Fa.next()).done; Wa = !1) {
|
|
268
268
|
const z = Na.value;
|
|
269
269
|
const q = yield ae(z);
|
|
270
270
|
if (q) {
|
|
271
|
-
const
|
|
272
|
-
e.insertContent(
|
|
271
|
+
const R = `<img src="${q}" alt="" />`;
|
|
272
|
+
e.insertContent(R);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
} catch (Na) {
|
|
@@ -282,22 +282,22 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
282
282
|
throw La[0];
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
|
|
285
|
+
H.value.show = !1;
|
|
286
286
|
}
|
|
287
|
-
|
|
287
|
+
s("input", e.getContent());
|
|
288
288
|
}), oe = (o) => {
|
|
289
289
|
var a;
|
|
290
290
|
o.preventDefault();
|
|
291
291
|
const e = o.clipboardData || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.clipboardData);
|
|
292
|
-
|
|
292
|
+
L(e);
|
|
293
293
|
}, te = (o) => {
|
|
294
294
|
var a;
|
|
295
295
|
o.preventDefault();
|
|
296
296
|
const e = o.dataTransfer || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.dataTransfer);
|
|
297
|
-
|
|
297
|
+
L(e);
|
|
298
298
|
};
|
|
299
|
-
|
|
300
|
-
var a,
|
|
299
|
+
Ee(() => {
|
|
300
|
+
var a, l, n;
|
|
301
301
|
const o = {
|
|
302
302
|
// 设置语言
|
|
303
303
|
language: "zh_CN",
|
|
@@ -380,85 +380,85 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
380
380
|
convert_urls: !1,
|
|
381
381
|
paste_webkit_styles: "all",
|
|
382
382
|
paste_data_images: !1,
|
|
383
|
-
images_file_types: ((
|
|
383
|
+
images_file_types: ((n = (l = (a = p.value) == null ? void 0 : a.checkOptions) == null ? void 0 : l.allowedType) == null ? void 0 : n.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
384
384
|
// 粘贴前处理
|
|
385
|
-
paste_preprocess(
|
|
386
|
-
|
|
385
|
+
paste_preprocess(t, r) {
|
|
386
|
+
r == null || r.preventDefault();
|
|
387
387
|
},
|
|
388
|
-
setup(
|
|
388
|
+
setup(t) {
|
|
389
389
|
var d, y;
|
|
390
|
-
const
|
|
391
|
-
|
|
390
|
+
const r = () => {
|
|
391
|
+
$.value.dialogVisible = !0;
|
|
392
392
|
};
|
|
393
|
-
if (
|
|
393
|
+
if (t.ui.registry.addMenuItem("localImage", {
|
|
394
394
|
text: "图片",
|
|
395
395
|
icon: "image",
|
|
396
|
-
onAction: () =>
|
|
397
|
-
}),
|
|
396
|
+
onAction: () => r()
|
|
397
|
+
}), t.ui.registry.addButton("localImage", {
|
|
398
398
|
icon: "image",
|
|
399
399
|
tooltip: "图片",
|
|
400
|
-
onAction: () =>
|
|
400
|
+
onAction: () => r()
|
|
401
401
|
}), (d = v == null ? void 0 : v.value) != null && d.enable) {
|
|
402
402
|
const f = () => {
|
|
403
403
|
w.value.dialogVisible = !0;
|
|
404
404
|
};
|
|
405
|
-
|
|
405
|
+
t.ui.registry.addMenuItem("localAudio", {
|
|
406
406
|
text: "音频",
|
|
407
407
|
icon: "arrow-right",
|
|
408
408
|
onAction: () => f()
|
|
409
|
-
}),
|
|
409
|
+
}), t.ui.registry.addButton("localAudio", {
|
|
410
410
|
icon: "arrow-right",
|
|
411
411
|
tooltip: "音频",
|
|
412
412
|
onAction: () => f()
|
|
413
413
|
});
|
|
414
414
|
}
|
|
415
|
-
if ((y =
|
|
415
|
+
if ((y = u == null ? void 0 : u.value) != null && y.enable) {
|
|
416
416
|
const f = () => {
|
|
417
417
|
_.value.dialogVisible = !0;
|
|
418
418
|
};
|
|
419
|
-
|
|
419
|
+
t.ui.registry.addMenuItem("localVideo", {
|
|
420
420
|
text: "视频",
|
|
421
421
|
icon: "embed",
|
|
422
422
|
onAction: () => f()
|
|
423
|
-
}),
|
|
423
|
+
}), t.ui.registry.addButton("localVideo", {
|
|
424
424
|
icon: "embed",
|
|
425
425
|
tooltip: "视频",
|
|
426
426
|
onAction: () => f()
|
|
427
427
|
});
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
|
-
}, e =
|
|
430
|
+
}, e = W(
|
|
431
431
|
[
|
|
432
432
|
i.options,
|
|
433
|
-
|
|
433
|
+
N.options,
|
|
434
434
|
o
|
|
435
435
|
],
|
|
436
436
|
{
|
|
437
|
-
mergeFunction: (
|
|
438
|
-
|
|
437
|
+
mergeFunction: (t, r) => (...d) => {
|
|
438
|
+
t(...d), r(...d);
|
|
439
439
|
},
|
|
440
440
|
type: Object
|
|
441
441
|
}
|
|
442
442
|
);
|
|
443
|
-
pe.init(e).then(([
|
|
444
|
-
var
|
|
445
|
-
|
|
443
|
+
pe.init(e).then(([t]) => {
|
|
444
|
+
var r;
|
|
445
|
+
t && (t.customProps = D({}, i), t.on("input", () => {
|
|
446
446
|
if (I.value) {
|
|
447
447
|
I.value = !1;
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
|
-
g.value = !0,
|
|
451
|
-
}),
|
|
452
|
-
|
|
453
|
-
}),
|
|
450
|
+
g.value = !0, s("input", t.getContent());
|
|
451
|
+
}), t.on("change", () => {
|
|
452
|
+
s("input", t.getContent());
|
|
453
|
+
}), t.on("paste", (d) => {
|
|
454
454
|
oe(d);
|
|
455
|
-
}),
|
|
455
|
+
}), t.on("drop", (d) => {
|
|
456
456
|
te(d);
|
|
457
|
-
}), (
|
|
457
|
+
}), (r = i.initComplete) == null || r.call(i, { editorIns: t }), m.value = t);
|
|
458
458
|
});
|
|
459
459
|
}), qe(() => {
|
|
460
|
-
var o, e, a,
|
|
461
|
-
(o =
|
|
460
|
+
var o, e, a, l;
|
|
461
|
+
(o = m.value) == null || o.off("input"), (e = m.value) == null || e.off("paste"), (a = m.value) == null || a.off("drop"), (l = m.value) == null || l.destroy();
|
|
462
462
|
});
|
|
463
463
|
const he = () => {
|
|
464
464
|
var e, a;
|
|
@@ -478,19 +478,20 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
478
478
|
var e, a;
|
|
479
479
|
const o = D({}, w.value.additionalData || {});
|
|
480
480
|
return ((a = (e = v.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
481
|
-
}, De = (o, e, a) => {
|
|
482
|
-
var
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
481
|
+
}, De = (o, e, a) => F(this, null, function* () {
|
|
482
|
+
var t, r;
|
|
483
|
+
const l = (r = (t = v == null ? void 0 : v.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : r.call(t, o);
|
|
484
|
+
let n;
|
|
485
|
+
l instanceof Promise ? n = yield l : n = l, n != null && n.url ? a[a.length - 1].url = n.url : n != null && n.errorMessage && (b.error(n.errorMessage), a.splice(a.length - 1, 1)), w.value.formData.file = a;
|
|
486
|
+
}), _e = (o, e) => new Promise((a, l) => {
|
|
487
|
+
var t, r, d, y, f, C, h, U;
|
|
488
|
+
const n = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
489
|
+
if (!((r = (t = v.value) == null ? void 0 : t.allowedType) != null && r.includes(n.toLowerCase()))) {
|
|
490
|
+
b.error(`请上传格式为${(y = (d = v.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的音频`), l();
|
|
490
491
|
return;
|
|
491
492
|
}
|
|
492
493
|
if (o.size > (((f = v.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
|
|
493
|
-
b.error(`请上传${((C = v.value) == null ? void 0 : C.maxSize) || 0}M内的音频`),
|
|
494
|
+
b.error(`请上传${((C = v.value) == null ? void 0 : C.maxSize) || 0}M内的音频`), l();
|
|
494
495
|
return;
|
|
495
496
|
}
|
|
496
497
|
w.value.additionalData = { file: o }, (U = (h = v == null ? void 0 : v.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
|
|
@@ -501,49 +502,51 @@ const Ha = /* @__PURE__ */ Ee({
|
|
|
501
502
|
}, Ce = () => {
|
|
502
503
|
var e, a;
|
|
503
504
|
const o = D({}, _.value.additionalData || {});
|
|
504
|
-
return ((a = (e =
|
|
505
|
+
return ((a = (e = u.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
505
506
|
}, Ue = () => {
|
|
506
507
|
var e, a;
|
|
507
508
|
const o = D({}, _.value.additionalData || {});
|
|
508
|
-
return ((a = (e =
|
|
509
|
-
}, Ie = (o, e, a) => {
|
|
510
|
-
var
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
509
|
+
return ((a = (e = u.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
510
|
+
}, Ie = (o, e, a) => F(this, null, function* () {
|
|
511
|
+
var t, r;
|
|
512
|
+
debugger;
|
|
513
|
+
const l = (r = (t = u == null ? void 0 : u.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : r.call(t, o);
|
|
514
|
+
let n;
|
|
515
|
+
l instanceof Promise ? n = yield l : n = l, n != null && n.url ? a[a.length - 1].url = n.url : n != null && n.errorMessage && (b.error(n.errorMessage), a.splice(a.length - 1, 1)), _.value.formData.file = a;
|
|
516
|
+
}), Pe = (o, e) => new Promise((a, l) => {
|
|
517
|
+
var t, r, d, y, f, C, h, U;
|
|
518
|
+
const n = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
519
|
+
if (!((r = (t = u == null ? void 0 : u.value) == null ? void 0 : t.allowedType) != null && r.includes(n.toLowerCase()))) {
|
|
520
|
+
b.error(`请上传格式为${(y = (d = u == null ? void 0 : u.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的视频`), l();
|
|
518
521
|
return;
|
|
519
522
|
}
|
|
520
|
-
if (o.size > (((f =
|
|
521
|
-
b.error(`请上传${((C =
|
|
523
|
+
if (o.size > (((f = u == null ? void 0 : u.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
|
|
524
|
+
b.error(`请上传${((C = u == null ? void 0 : u.value) == null ? void 0 : C.maxSize) || 0}M内的视频`), l();
|
|
522
525
|
return;
|
|
523
526
|
}
|
|
524
|
-
_.value.additionalData = { file: o }, (U = (h =
|
|
527
|
+
_.value.additionalData = { file: o }, (U = (h = u == null ? void 0 : u.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
|
|
525
528
|
}), Me = (o, e) => {
|
|
526
529
|
_.value.formData.file = e;
|
|
527
530
|
}, Se = (o, e, a) => {
|
|
528
531
|
b.error("上传发生错误,请重试!"), _.value.formData.file = a;
|
|
529
532
|
};
|
|
530
|
-
return de(() => [i.disabled,
|
|
533
|
+
return de(() => [i.disabled, m.value], () => {
|
|
531
534
|
var o, e;
|
|
532
|
-
(e = (o =
|
|
535
|
+
(e = (o = m.value) == null ? void 0 : o.mode) == null || e.set(i.disabled ? "readonly" : "design");
|
|
533
536
|
}, { immediate: !0 }), de(
|
|
534
|
-
() => [i.value,
|
|
537
|
+
() => [i.value, m.value],
|
|
535
538
|
() => {
|
|
536
|
-
var o, e, a,
|
|
539
|
+
var o, e, a, l;
|
|
537
540
|
if (g.value) {
|
|
538
541
|
g.value = !1;
|
|
539
542
|
return;
|
|
540
543
|
}
|
|
541
|
-
I.value = !0, (o =
|
|
544
|
+
I.value = !0, (o = m.value) == null || o.setContent(i.value ? i.value : ""), (a = m.value) == null || a.selection.select((e = m.value) == null ? void 0 : e.getBody(), !0), (l = m.value) == null || l.selection.collapse(!1);
|
|
542
545
|
},
|
|
543
546
|
{ immediate: !0 }
|
|
544
|
-
), { __sfc: !0, defaultImageUploadOptions: O, defaultVideoUploadOptions: T, defaultAudioUploadOptions: P, props: i, emits:
|
|
547
|
+
), { __sfc: !0, defaultImageUploadOptions: O, defaultVideoUploadOptions: T, defaultAudioUploadOptions: P, props: i, emits: s, insRef: V, editorRef: m, preventSettingContent: g, preventUpdatingModelValue: I, uploadLoadingConfig: H, mergeImageUploadOptions: p, mergeVideoUploadOptions: u, mergeAudioUploadOptions: v, uploadImage: $, uploadImageAdditionalData: j, uploadImageFormRef: J, onUploadImageClose: K, onUploadImageConfirm: fe, uploadAudio: w, uploadAudioFormRef: Q, onUploadAudioClose: Y, onUploadAudioConfirm: ve, uploadVideo: _, uploadVideoFormRef: Z, onUploadVideoClose: ee, onUploadVideoConfirm: ge, uploadPasteOrDropFile: ae, handleDataTransfer: L, onValuePaste: oe, onValueDrop: te, getUploadImageData: he, getUploadImageHeaders: xe, onUploadImageInnerBeforeUploadEnd: be, getUploadAudioData: we, getUploadAudioHeaders: ye, onUploadAudioSuccess: De, onUploadAudioBeforeUpload: _e, onUploadAudioRemove: ke, onUploadAudioError: Ae, getUploadVideoData: Ce, getUploadVideoHeaders: Ue, onUploadVideoSuccess: Ie, onUploadVideoBeforeUpload: Pe, onUploadVideoRemove: Me, onUploadVideoError: Se };
|
|
545
548
|
}
|
|
546
549
|
});
|
|
547
550
|
export {
|
|
548
|
-
|
|
551
|
+
Ra as default
|
|
549
552
|
};
|
package/es/types.d.ts
CHANGED
|
@@ -86,7 +86,10 @@ export interface VideoUploadOptions {
|
|
|
86
86
|
handlerResponse?: (response: any) => {
|
|
87
87
|
url?: string;
|
|
88
88
|
errorMessage?: string;
|
|
89
|
-
}
|
|
89
|
+
} | Promise<{
|
|
90
|
+
url?: string;
|
|
91
|
+
errorMessage?: string;
|
|
92
|
+
}>;
|
|
90
93
|
}
|
|
91
94
|
/** 音频选项 */
|
|
92
95
|
export interface AudioUploadOptions {
|
|
@@ -118,5 +121,8 @@ export interface AudioUploadOptions {
|
|
|
118
121
|
handlerResponse?: (response: any) => {
|
|
119
122
|
url?: string;
|
|
120
123
|
errorMessage?: string;
|
|
121
|
-
}
|
|
124
|
+
} | Promise<{
|
|
125
|
+
url?: string;
|
|
126
|
+
errorMessage?: string;
|
|
127
|
+
}>;
|
|
122
128
|
}
|
package/package.json
CHANGED