@keyblade/tinymce-editor-vue2 0.0.12-alpha.43 → 0.0.12-alpha.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/editor.vue2.js +183 -174
- package/package.json +1 -1
package/es/editor.vue2.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImgPondBeforeAddFile as
|
|
3
|
-
import { blobToFile as
|
|
1
|
+
import { defineComponent as xe, ref as x, computed as A, watch as U, onMounted as we, onUnmounted as be } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as K } from "@keyblade/one-travel";
|
|
3
|
+
import { blobToFile as Q, getFileExtension as X, generateUUID as _e, getImagePixel as Te } from "./util.js";
|
|
4
4
|
import "./style.less.js";
|
|
5
|
-
import
|
|
5
|
+
import Ae from "imgpond";
|
|
6
6
|
import { conclude as C } from "vue-global-config";
|
|
7
|
-
import
|
|
7
|
+
import Y from "tinymce";
|
|
8
8
|
import Ce from "./langs/zh_CN.js";
|
|
9
9
|
import "tinymce/skins/ui/oxide/skin";
|
|
10
10
|
import "tinymce/models/dom";
|
|
@@ -34,9 +34,9 @@ import "tinymce/plugins/table";
|
|
|
34
34
|
import "tinymce/plugins/visualblocks";
|
|
35
35
|
import "tinymce/plugins/visualchars";
|
|
36
36
|
import "tinymce/plugins/wordcount";
|
|
37
|
-
import { globalProps as
|
|
37
|
+
import { globalProps as D } from "./index.js";
|
|
38
38
|
import { Message as y } from "element-ui";
|
|
39
|
-
const
|
|
39
|
+
const ma = /* @__PURE__ */ xe({
|
|
40
40
|
__name: "editor",
|
|
41
41
|
props: {
|
|
42
42
|
value: { default: "" },
|
|
@@ -50,10 +50,10 @@ const da = /* @__PURE__ */ he({
|
|
|
50
50
|
initComplete: null
|
|
51
51
|
},
|
|
52
52
|
emits: ["input"],
|
|
53
|
-
setup(
|
|
54
|
-
const m =
|
|
55
|
-
|
|
56
|
-
const
|
|
53
|
+
setup(Z, { emit: H }) {
|
|
54
|
+
const m = Z;
|
|
55
|
+
Y.addI18n("zh_CN", Ce);
|
|
56
|
+
const V = {
|
|
57
57
|
maxCount: 10,
|
|
58
58
|
tipText: "上传",
|
|
59
59
|
maxSize: 30,
|
|
@@ -63,75 +63,75 @@ const da = /* @__PURE__ */ he({
|
|
|
63
63
|
minHeight: 50,
|
|
64
64
|
maxWidth: 6e3,
|
|
65
65
|
maxHeight: 6e3
|
|
66
|
-
},
|
|
66
|
+
}, B = {
|
|
67
67
|
enable: !0,
|
|
68
68
|
maxSize: 300,
|
|
69
69
|
allowedType: ["mp4", "3gp"],
|
|
70
70
|
accept: "video/mp4,video/3gpp"
|
|
71
|
-
},
|
|
71
|
+
}, W = {
|
|
72
72
|
enable: !0,
|
|
73
73
|
maxSize: 200,
|
|
74
74
|
allowedType: ["mp3", "m4a", "wav", "aac"],
|
|
75
75
|
accept: "audio/mp3,audio/wav,audio/aac,audio/x-m4a"
|
|
76
|
-
},
|
|
76
|
+
}, $ = x(), f = x(), P = x(!1), M = x(!1), g = x({
|
|
77
77
|
show: !1,
|
|
78
78
|
text: "图片上传中,请稍等"
|
|
79
|
-
}), d =
|
|
80
|
-
var e,
|
|
81
|
-
return ((
|
|
82
|
-
}),
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
}), d = A(() => C([m.imageUploadOptions, D.imageUploadOptions, V]) || {}), c = A(() => C([m.videoUploadOptions, D.videoUploadOptions, B]) || {}), h = A(() => C([m.audioUploadOptions, D.audioUploadOptions, W]) || {}), z = A(() => C([m.imgPondOptions, D.imgPondOptions]) || {}), ee = A(() => {
|
|
80
|
+
var e, t;
|
|
81
|
+
return ((t = (e = d == null ? void 0 : d.value) == null ? void 0 : e.allowedType) == null ? void 0 : t.map((i) => `.${i}`).join(",")) || "";
|
|
82
|
+
}), k = x();
|
|
83
|
+
U(() => k.value, () => {
|
|
84
|
+
k.value && J(k.value, {
|
|
85
85
|
onStart: () => {
|
|
86
|
-
|
|
86
|
+
g.value = {
|
|
87
87
|
show: !0,
|
|
88
88
|
text: "图片加载中,请稍等"
|
|
89
89
|
};
|
|
90
90
|
},
|
|
91
91
|
onSuccess: () => {
|
|
92
|
-
|
|
92
|
+
g.value.show = !1;
|
|
93
93
|
},
|
|
94
94
|
onError: (e) => {
|
|
95
|
-
|
|
95
|
+
g.value.show = !1, y.error(e);
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
}, { immediate: !0 });
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const I = x();
|
|
100
|
+
U(() => I.value, () => {
|
|
101
|
+
I.value && J(I.value, {
|
|
102
102
|
onStart: () => {
|
|
103
|
-
|
|
103
|
+
g.value = {
|
|
104
104
|
show: !0,
|
|
105
105
|
text: "图片加载中,请稍等"
|
|
106
106
|
};
|
|
107
107
|
},
|
|
108
108
|
onSuccess: () => {
|
|
109
|
-
|
|
109
|
+
g.value.show = !1;
|
|
110
110
|
},
|
|
111
111
|
onError: (e) => {
|
|
112
|
-
|
|
112
|
+
g.value.show = !1, y.error(e);
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
}, { immediate: !0 });
|
|
116
|
-
const
|
|
116
|
+
const T = x({
|
|
117
117
|
dialogVisible: !1,
|
|
118
118
|
formData: {
|
|
119
119
|
images: []
|
|
120
120
|
}
|
|
121
|
-
}),
|
|
122
|
-
|
|
121
|
+
}), E = x(), R = () => {
|
|
122
|
+
T.value.dialogVisible = !1, T.value.formData = {
|
|
123
123
|
images: []
|
|
124
124
|
};
|
|
125
|
-
},
|
|
125
|
+
}, ae = () => {
|
|
126
126
|
var e;
|
|
127
|
-
(e =
|
|
128
|
-
|
|
127
|
+
(e = E.value) == null || e.validate((t) => {
|
|
128
|
+
t && (T.value.formData.images.forEach((i) => {
|
|
129
129
|
var o;
|
|
130
|
-
let a =
|
|
131
|
-
|
|
132
|
-
}),
|
|
130
|
+
let a = i;
|
|
131
|
+
z.value.srcAt && (a = (i == null ? void 0 : i[z.value.srcAt]) || ""), (o = f.value) == null || o.insertContent(`<img src=${a} alt="" />`);
|
|
132
|
+
}), R());
|
|
133
133
|
});
|
|
134
|
-
}, v =
|
|
134
|
+
}, v = x({
|
|
135
135
|
dialogVisible: !1,
|
|
136
136
|
formData: {
|
|
137
137
|
// 名称
|
|
@@ -143,19 +143,19 @@ const da = /* @__PURE__ */ he({
|
|
|
143
143
|
},
|
|
144
144
|
// 用于临时保存上传前的参数 { file: File }
|
|
145
145
|
additionalData: {}
|
|
146
|
-
}),
|
|
146
|
+
}), j = x(), q = () => {
|
|
147
147
|
v.value.dialogVisible = !1, v.value.formData = {
|
|
148
148
|
name: "",
|
|
149
149
|
cover: [],
|
|
150
150
|
file: []
|
|
151
151
|
}, v.value.additionalData = {};
|
|
152
|
-
},
|
|
152
|
+
}, oe = () => {
|
|
153
153
|
var e;
|
|
154
|
-
(e =
|
|
155
|
-
var
|
|
156
|
-
|
|
154
|
+
(e = j.value) == null || e.validate((t) => {
|
|
155
|
+
var i, a;
|
|
156
|
+
t && ((a = f.value) == null || a.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(i = v.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), q());
|
|
157
157
|
});
|
|
158
|
-
},
|
|
158
|
+
}, w = x({
|
|
159
159
|
dialogVisible: !1,
|
|
160
160
|
formData: {
|
|
161
161
|
// 文件
|
|
@@ -163,48 +163,48 @@ const da = /* @__PURE__ */ he({
|
|
|
163
163
|
},
|
|
164
164
|
// 用于临时保存上传前的参数 { file: File }
|
|
165
165
|
additionalData: {}
|
|
166
|
-
}),
|
|
167
|
-
|
|
166
|
+
}), N = x(), F = () => {
|
|
167
|
+
w.value.dialogVisible = !1, w.value.formData = {
|
|
168
168
|
file: []
|
|
169
|
-
},
|
|
170
|
-
},
|
|
169
|
+
}, w.value.additionalData = {};
|
|
170
|
+
}, te = () => {
|
|
171
171
|
var e;
|
|
172
|
-
(e =
|
|
173
|
-
var
|
|
174
|
-
|
|
172
|
+
(e = N.value) == null || e.validate((t) => {
|
|
173
|
+
var i, a;
|
|
174
|
+
t && ((a = f.value) == null || a.insertContent(`<video width="auto" height="auto" controls src="${(i = w.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), F());
|
|
175
175
|
});
|
|
176
|
-
},
|
|
176
|
+
}, ie = () => {
|
|
177
177
|
document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
|
|
178
178
|
e && (e.innerHTML = `单次最多可选择${d.value.maxCount}张图片`);
|
|
179
179
|
});
|
|
180
|
-
},
|
|
181
|
-
var r,
|
|
182
|
-
const o = await
|
|
180
|
+
}, le = (e, t) => new Promise(async (i, a) => {
|
|
181
|
+
var r, n;
|
|
182
|
+
const o = await K(e);
|
|
183
183
|
if (!o.success) {
|
|
184
184
|
a(), setTimeout(() => {
|
|
185
|
-
|
|
185
|
+
t.onError(o.errorMessage);
|
|
186
186
|
});
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
if (!
|
|
189
|
+
const l = await ((n = (r = d.value).handleRequest) == null ? void 0 : n.call(r, Q(o.file, e.name), e.name, { extParameters: m.extParameters }));
|
|
190
|
+
if (!l || !(l != null && l.success)) {
|
|
191
191
|
a(), setTimeout(() => {
|
|
192
|
-
|
|
192
|
+
t.onError(l == null ? void 0 : l.errorMessage);
|
|
193
193
|
});
|
|
194
194
|
return;
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
i(l.url);
|
|
197
197
|
});
|
|
198
|
-
async function
|
|
199
|
-
const a =
|
|
200
|
-
for (let
|
|
201
|
-
const r = a[
|
|
202
|
-
r.classList.add(
|
|
198
|
+
async function L(e, t) {
|
|
199
|
+
const a = t.node.getElementsByTagName("img"), o = [];
|
|
200
|
+
for (let l = a.length - 1; l >= 0; l--) {
|
|
201
|
+
const r = a[l], n = "img-" + _e();
|
|
202
|
+
r.classList.add(n), o.push(n);
|
|
203
203
|
}
|
|
204
204
|
setTimeout(async () => {
|
|
205
|
-
var
|
|
206
|
-
for (let
|
|
207
|
-
const s = e.dom.select(`.${o[
|
|
205
|
+
var l, r;
|
|
206
|
+
for (let n = o.length - 1; n >= 0; n--) {
|
|
207
|
+
const s = e.dom.select(`.${o[n]}`);
|
|
208
208
|
if (s.length === 0)
|
|
209
209
|
continue;
|
|
210
210
|
const u = s[0], p = u.src;
|
|
@@ -212,13 +212,13 @@ const da = /* @__PURE__ */ he({
|
|
|
212
212
|
e.dom.remove(u);
|
|
213
213
|
continue;
|
|
214
214
|
} else if (p.startsWith("http://") || p.startsWith("https://")) {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
215
|
+
const b = await Te(p);
|
|
216
|
+
if (b && (b.width < (d.value.minWidth || 0) && b.height < (d.value.minHeight || 0) || b.width > (d.value.maxWidth || 0) && b.height > (d.value.maxHeight || 0))) {
|
|
217
217
|
e.dom.remove(u);
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
|
-
const
|
|
221
|
-
if (!((r = (
|
|
220
|
+
const S = X(p);
|
|
221
|
+
if (!((r = (l = d.value) == null ? void 0 : l.allowedType) != null && r.includes(S.toLowerCase()))) {
|
|
222
222
|
e.dom.remove(u);
|
|
223
223
|
continue;
|
|
224
224
|
}
|
|
@@ -226,13 +226,20 @@ const da = /* @__PURE__ */ he({
|
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
const _ = () => {
|
|
230
|
+
setTimeout(() => {
|
|
231
|
+
var t;
|
|
232
|
+
const e = document.querySelector(".tox-notifications-container");
|
|
233
|
+
(t = e == null ? void 0 : e.remove) == null || t.call(e);
|
|
234
|
+
}, 2e3);
|
|
235
|
+
};
|
|
236
|
+
we(() => {
|
|
237
|
+
var i;
|
|
231
238
|
const e = {
|
|
232
239
|
// 设置语言
|
|
233
240
|
language: "zh_CN",
|
|
234
241
|
// 实例
|
|
235
|
-
target:
|
|
242
|
+
target: $.value,
|
|
236
243
|
// 隐藏品牌
|
|
237
244
|
branding: !1,
|
|
238
245
|
// 隐藏右上角升级按钮
|
|
@@ -310,28 +317,28 @@ const da = /* @__PURE__ */ he({
|
|
|
310
317
|
convert_urls: !1,
|
|
311
318
|
paste_webkit_styles: "all",
|
|
312
319
|
paste_data_images: !0,
|
|
313
|
-
images_file_types: ((
|
|
320
|
+
images_file_types: ((i = d.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
314
321
|
// 粘贴前处理
|
|
315
322
|
paste_preprocess(a, o) {
|
|
316
323
|
o.content = o.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), o.content = o.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), o.content = o.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), o.content = o.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), o.content = o.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), o.content = o.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), o.content = o.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), o.content = o.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), o.content = o.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), o.content = o.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
|
|
317
324
|
},
|
|
318
325
|
// 粘贴后处理(处理异步操作)
|
|
319
326
|
paste_postprocess(a, o) {
|
|
320
|
-
|
|
327
|
+
L(a, o);
|
|
321
328
|
},
|
|
322
329
|
images_upload_handler(a) {
|
|
323
|
-
return new Promise(async (o,
|
|
324
|
-
var
|
|
325
|
-
if (!((
|
|
326
|
-
return
|
|
327
|
-
|
|
330
|
+
return new Promise(async (o, l) => {
|
|
331
|
+
var b, S, O;
|
|
332
|
+
if (!((b = d.value) != null && b.handleRequest))
|
|
333
|
+
return _(), l({ message: "缺少图片上传配置", remove: !0 });
|
|
334
|
+
g.value = {
|
|
328
335
|
show: !0,
|
|
329
336
|
text: "图片上传中,请稍等"
|
|
330
337
|
};
|
|
331
|
-
let r = a.blob(),
|
|
338
|
+
let r = a.blob(), n = r.name ? r.name : a.filename();
|
|
332
339
|
if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
|
|
333
|
-
return
|
|
334
|
-
const s = await
|
|
340
|
+
return g.value.show = !1, _(), l({ message: "不允许粘贴", remove: !0 });
|
|
341
|
+
const s = await ye(r, n, {
|
|
335
342
|
imageMaxSize: d.value.maxSize,
|
|
336
343
|
imageAllowedType: d.value.allowedType,
|
|
337
344
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
@@ -341,28 +348,28 @@ const da = /* @__PURE__ */ he({
|
|
|
341
348
|
imageMaxHeight: d.value.maxHeight
|
|
342
349
|
});
|
|
343
350
|
if (!s.success)
|
|
344
|
-
return
|
|
351
|
+
return g.value.show = !1, _(), l({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
|
|
345
352
|
if (s.hasTransform) {
|
|
346
353
|
r = s.file;
|
|
347
|
-
const
|
|
348
|
-
|
|
354
|
+
const G = n == null ? void 0 : n.split(".");
|
|
355
|
+
G.pop(), n = `${G.join(",")}.jpg`;
|
|
349
356
|
}
|
|
350
|
-
const u = await
|
|
357
|
+
const u = await K(r);
|
|
351
358
|
if (!u.success)
|
|
352
|
-
return
|
|
353
|
-
const p = await ((
|
|
359
|
+
return g.value.show = !1, _(), l({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
|
|
360
|
+
const p = await ((O = (S = d.value).handleRequest) == null ? void 0 : O.call(S, Q(u.file, n), n, { extParameters: m.extParameters }));
|
|
354
361
|
if (!p || !p.success)
|
|
355
|
-
return
|
|
356
|
-
|
|
362
|
+
return g.value.show = !1, _(), l({ message: p.errorMessage, remove: !0 });
|
|
363
|
+
g.value.show = !1, o(p.url);
|
|
357
364
|
});
|
|
358
365
|
},
|
|
359
366
|
setup(a) {
|
|
360
|
-
var
|
|
367
|
+
var l, r;
|
|
361
368
|
const o = () => {
|
|
362
|
-
|
|
369
|
+
T.value.dialogVisible = !0, setTimeout(() => {
|
|
363
370
|
var s, u;
|
|
364
|
-
const
|
|
365
|
-
|
|
371
|
+
const n = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
372
|
+
n && (n.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
|
|
366
373
|
});
|
|
367
374
|
};
|
|
368
375
|
if (a.ui.registry.addMenuItem("localImage", {
|
|
@@ -373,8 +380,8 @@ const da = /* @__PURE__ */ he({
|
|
|
373
380
|
icon: "image",
|
|
374
381
|
tooltip: "图片",
|
|
375
382
|
onAction: () => o()
|
|
376
|
-
}), (
|
|
377
|
-
const
|
|
383
|
+
}), (l = h == null ? void 0 : h.value) != null && l.enable) {
|
|
384
|
+
const n = () => {
|
|
378
385
|
v.value.dialogVisible = !0, setTimeout(() => {
|
|
379
386
|
var u, p;
|
|
380
387
|
const s = (u = document == null ? void 0 : document.querySelector) == null ? void 0 : u.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
@@ -384,136 +391,138 @@ const da = /* @__PURE__ */ he({
|
|
|
384
391
|
a.ui.registry.addMenuItem("localAudio", {
|
|
385
392
|
text: "音频",
|
|
386
393
|
icon: "arrow-right",
|
|
387
|
-
onAction: () =>
|
|
394
|
+
onAction: () => n()
|
|
388
395
|
}), a.ui.registry.addButton("localAudio", {
|
|
389
396
|
icon: "arrow-right",
|
|
390
397
|
tooltip: "音频",
|
|
391
|
-
onAction: () =>
|
|
398
|
+
onAction: () => n()
|
|
392
399
|
});
|
|
393
400
|
}
|
|
394
401
|
if ((r = c == null ? void 0 : c.value) != null && r.enable) {
|
|
395
|
-
const
|
|
396
|
-
|
|
402
|
+
const n = () => {
|
|
403
|
+
w.value.dialogVisible = !0;
|
|
397
404
|
};
|
|
398
405
|
a.ui.registry.addMenuItem("localVideo", {
|
|
399
406
|
text: "视频",
|
|
400
407
|
icon: "embed",
|
|
401
|
-
onAction: () =>
|
|
408
|
+
onAction: () => n()
|
|
402
409
|
}), a.ui.registry.addButton("localVideo", {
|
|
403
410
|
icon: "embed",
|
|
404
411
|
tooltip: "视频",
|
|
405
|
-
onAction: () =>
|
|
412
|
+
onAction: () => n()
|
|
406
413
|
});
|
|
407
414
|
}
|
|
408
415
|
}
|
|
409
|
-
},
|
|
416
|
+
}, t = C(
|
|
410
417
|
[
|
|
411
418
|
m.options,
|
|
412
|
-
|
|
419
|
+
D.options,
|
|
413
420
|
e
|
|
414
421
|
],
|
|
415
422
|
{
|
|
416
|
-
mergeFunction: (a, o) => (...
|
|
417
|
-
a(...
|
|
423
|
+
mergeFunction: (a, o) => (...l) => {
|
|
424
|
+
a(...l), o(...l);
|
|
418
425
|
},
|
|
419
426
|
type: Object
|
|
420
427
|
}
|
|
421
428
|
);
|
|
422
|
-
|
|
429
|
+
Y.init(t).then(([a]) => {
|
|
423
430
|
var o;
|
|
424
|
-
a && (a.customProps = { ...m }, a.on("
|
|
425
|
-
if (
|
|
426
|
-
|
|
431
|
+
a && (a.customProps = { ...m }, a.on("input", () => {
|
|
432
|
+
if (M.value) {
|
|
433
|
+
M.value = !1;
|
|
427
434
|
return;
|
|
428
435
|
}
|
|
429
|
-
|
|
430
|
-
}), a.on("paste", (
|
|
431
|
-
var
|
|
432
|
-
const r = ((
|
|
436
|
+
P.value = !0, H("input", a.getContent());
|
|
437
|
+
}), a.on("paste", (l) => {
|
|
438
|
+
var n, s;
|
|
439
|
+
const r = ((n = l.clipboardData) == null ? void 0 : n.files) || [];
|
|
433
440
|
for (let u of r) {
|
|
434
|
-
const p =
|
|
435
|
-
(s = d.value.allowedType) != null && s.includes(p.toLowerCase()) ||
|
|
441
|
+
const p = X(u.name) || "";
|
|
442
|
+
(s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || l.preventDefault();
|
|
436
443
|
}
|
|
437
|
-
}),
|
|
444
|
+
}), a.on("drop", () => {
|
|
445
|
+
_();
|
|
446
|
+
}), (o = m.initComplete) == null || o.call(m, { editorIns: a }), f.value = a);
|
|
438
447
|
});
|
|
439
|
-
}),
|
|
440
|
-
var e;
|
|
441
|
-
(e =
|
|
448
|
+
}), be(() => {
|
|
449
|
+
var e, t, i, a;
|
|
450
|
+
(e = f.value) == null || e.off("input"), (t = f.value) == null || t.off("paste"), (i = f.value) == null || i.off("drop"), (a = f.value) == null || a.destroy();
|
|
442
451
|
});
|
|
443
452
|
const ne = () => {
|
|
444
|
-
var
|
|
453
|
+
var t, i;
|
|
445
454
|
const e = { ...v.value.additionalData || {} };
|
|
446
|
-
return ((
|
|
447
|
-
},
|
|
448
|
-
var
|
|
455
|
+
return ((i = (t = h.value) == null ? void 0 : t.data) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
|
|
456
|
+
}, re = () => {
|
|
457
|
+
var t, i;
|
|
449
458
|
const e = { ...v.value.additionalData || {} };
|
|
450
|
-
return ((
|
|
451
|
-
},
|
|
452
|
-
var o,
|
|
453
|
-
const a = (
|
|
454
|
-
a != null && a.url ?
|
|
455
|
-
},
|
|
456
|
-
var
|
|
459
|
+
return ((i = (t = h.value) == null ? void 0 : t.headers) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
|
|
460
|
+
}, se = (e, t, i) => {
|
|
461
|
+
var o, l;
|
|
462
|
+
const a = (l = (o = h == null ? void 0 : h.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : l.call(o, e);
|
|
463
|
+
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), i.splice(i.length - 1, 1)), v.value.formData.file = i;
|
|
464
|
+
}, ue = (e, t) => new Promise((i, a) => {
|
|
465
|
+
var l, r, n, s, u, p;
|
|
457
466
|
const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
458
|
-
if (!((r = (
|
|
459
|
-
y.error(`请上传格式为${(s = (
|
|
467
|
+
if (!((r = (l = h.value) == null ? void 0 : l.allowedType) != null && r.includes(o.toLowerCase()))) {
|
|
468
|
+
y.error(`请上传格式为${(s = (n = h.value) == null ? void 0 : n.allowedType) == null ? void 0 : s.map((b) => b.toUpperCase()).join("、")}的音频`), a();
|
|
460
469
|
return;
|
|
461
470
|
}
|
|
462
|
-
if (e.size > (((u =
|
|
463
|
-
y.error(`请上传${((p =
|
|
471
|
+
if (e.size > (((u = h.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
472
|
+
y.error(`请上传${((p = h.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
|
|
464
473
|
return;
|
|
465
474
|
}
|
|
466
|
-
v.value.additionalData = { file: e },
|
|
467
|
-
}),
|
|
468
|
-
v.value.formData.file =
|
|
469
|
-
},
|
|
470
|
-
y.error("上传发生错误,请重试!"), v.value.formData.file =
|
|
471
|
-
}, me = () => {
|
|
472
|
-
var i, t;
|
|
473
|
-
const e = { ...x.value.additionalData || {} };
|
|
474
|
-
return ((t = (i = c.value) == null ? void 0 : i.data) == null ? void 0 : t.call(i, { ...e, extParameters: m.extParameters })) || {};
|
|
475
|
+
v.value.additionalData = { file: e }, i(!0);
|
|
476
|
+
}), de = (e, t) => {
|
|
477
|
+
v.value.formData.file = t;
|
|
478
|
+
}, me = (e, t, i) => {
|
|
479
|
+
y.error("上传发生错误,请重试!"), v.value.formData.file = i;
|
|
475
480
|
}, ce = () => {
|
|
476
|
-
var
|
|
477
|
-
const e = { ...
|
|
478
|
-
return ((
|
|
479
|
-
}, pe = (
|
|
480
|
-
var
|
|
481
|
-
const
|
|
482
|
-
|
|
483
|
-
}, ve = (e,
|
|
484
|
-
var
|
|
481
|
+
var t, i;
|
|
482
|
+
const e = { ...w.value.additionalData || {} };
|
|
483
|
+
return ((i = (t = c.value) == null ? void 0 : t.data) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
|
|
484
|
+
}, pe = () => {
|
|
485
|
+
var t, i;
|
|
486
|
+
const e = { ...w.value.additionalData || {} };
|
|
487
|
+
return ((i = (t = c.value) == null ? void 0 : t.headers) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
|
|
488
|
+
}, ve = (e, t, i) => {
|
|
489
|
+
var o, l;
|
|
490
|
+
const a = (l = (o = c == null ? void 0 : c.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : l.call(o, e);
|
|
491
|
+
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), i.splice(i.length - 1, 1)), w.value.formData.file = i;
|
|
492
|
+
}, fe = (e, t) => new Promise((i, a) => {
|
|
493
|
+
var l, r, n, s, u, p;
|
|
485
494
|
const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
486
|
-
if (!((r = (
|
|
487
|
-
y.error(`请上传格式为${(s = (
|
|
495
|
+
if (!((r = (l = c == null ? void 0 : c.value) == null ? void 0 : l.allowedType) != null && r.includes(o.toLowerCase()))) {
|
|
496
|
+
y.error(`请上传格式为${(s = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) == null ? void 0 : s.map((b) => b.toUpperCase()).join("、")}的视频`), a();
|
|
488
497
|
return;
|
|
489
498
|
}
|
|
490
499
|
if (e.size > (((u = c == null ? void 0 : c.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
491
500
|
y.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
|
|
492
501
|
return;
|
|
493
502
|
}
|
|
494
|
-
|
|
495
|
-
}),
|
|
496
|
-
|
|
497
|
-
},
|
|
498
|
-
y.error("上传发生错误,请重试!"),
|
|
503
|
+
w.value.additionalData = { file: e }, i(!0);
|
|
504
|
+
}), ge = (e, t) => {
|
|
505
|
+
w.value.formData.file = t;
|
|
506
|
+
}, he = (e, t, i) => {
|
|
507
|
+
y.error("上传发生错误,请重试!"), w.value.formData.file = i;
|
|
499
508
|
};
|
|
500
|
-
return
|
|
501
|
-
var e,
|
|
502
|
-
(
|
|
503
|
-
}, { immediate: !0 }),
|
|
504
|
-
() => [m.value,
|
|
509
|
+
return U(() => [m.disabled, f.value], () => {
|
|
510
|
+
var e, t;
|
|
511
|
+
(t = (e = f.value) == null ? void 0 : e.mode) == null || t.set(m.disabled ? "readonly" : "design");
|
|
512
|
+
}, { immediate: !0 }), U(
|
|
513
|
+
() => [m.value, f.value],
|
|
505
514
|
() => {
|
|
506
515
|
var e;
|
|
507
|
-
if (
|
|
508
|
-
|
|
516
|
+
if (P.value) {
|
|
517
|
+
P.value = !1;
|
|
509
518
|
return;
|
|
510
519
|
}
|
|
511
|
-
|
|
520
|
+
M.value = !0, (e = f.value) == null || e.setContent(m.value ? m.value : "");
|
|
512
521
|
},
|
|
513
522
|
{ immediate: !0 }
|
|
514
|
-
), { __sfc: !0, defaultImageUploadOptions:
|
|
523
|
+
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: W, props: m, emits: H, insRef: $, editorRef: f, preventSettingContent: P, preventUpdatingModelValue: M, uploadLoadingConfig: g, mergeImageUploadOptions: d, mergeVideoUploadOptions: c, mergeAudioUploadOptions: h, mergeImgPondOptions: z, imgPondAccept: ee, uploadImageImgPondRef: k, audioImageImgPondRef: I, uploadImage: T, uploadImageFormRef: E, onUploadImageClose: R, onUploadImageConfirm: ae, uploadAudio: v, uploadAudioFormRef: j, onUploadAudioClose: q, onUploadAudioConfirm: oe, uploadVideo: w, uploadVideoFormRef: N, onUploadVideoClose: F, onUploadVideoConfirm: te, onImageUploadUploadExceed: ie, onImageUploadUpload: le, processPastedImage: L, removeNotification: _, getUploadAudioData: ne, getUploadAudioHeaders: re, onUploadAudioSuccess: se, onUploadAudioBeforeUpload: ue, onUploadAudioRemove: de, onUploadAudioError: me, getUploadVideoData: ce, getUploadVideoHeaders: pe, onUploadVideoSuccess: ve, onUploadVideoBeforeUpload: fe, onUploadVideoRemove: ge, onUploadVideoError: he, ImgPond: Ae };
|
|
515
524
|
}
|
|
516
525
|
});
|
|
517
526
|
export {
|
|
518
|
-
|
|
527
|
+
ma as default
|
|
519
528
|
};
|
package/package.json
CHANGED