@keyblade/tinymce-editor-vue2 0.0.12-alpha.20 → 0.0.12-alpha.21
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 +191 -184
- 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 { getImagePixel as
|
|
4
|
-
import
|
|
1
|
+
import { defineComponent as fe, ref as h, computed as w, watch as S, onMounted as ge, onUnmounted as he } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as xe, oneTravelImageCompressor as K } from "@keyblade/one-travel";
|
|
3
|
+
import { getImagePixel as be, getFileExtension as ye } from "./util.js";
|
|
4
|
+
import _e from "imgpond";
|
|
5
5
|
import { conclude as A } from "vue-global-config";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import Q from "tinymce";
|
|
7
|
+
import we from "./langs/zh_CN.js";
|
|
8
8
|
import "tinymce/skins/ui/oxide/skin";
|
|
9
9
|
import "tinymce/models/dom";
|
|
10
10
|
import "tinymce/themes/silver";
|
|
@@ -35,7 +35,7 @@ import "tinymce/plugins/visualchars";
|
|
|
35
35
|
import "tinymce/plugins/wordcount";
|
|
36
36
|
import { globalProps as C } from "./index.js";
|
|
37
37
|
import { Loading as k, Message as b } from "element-ui";
|
|
38
|
-
const
|
|
38
|
+
const ra = /* @__PURE__ */ fe({
|
|
39
39
|
__name: "editor",
|
|
40
40
|
props: {
|
|
41
41
|
value: { default: "" },
|
|
@@ -49,9 +49,9 @@ const na = /* @__PURE__ */ ve({
|
|
|
49
49
|
initComplete: null
|
|
50
50
|
},
|
|
51
51
|
emits: ["input"],
|
|
52
|
-
setup(
|
|
53
|
-
const u =
|
|
54
|
-
|
|
52
|
+
setup(X, { emit: z }) {
|
|
53
|
+
const u = X;
|
|
54
|
+
Q.addI18n("zh_CN", we);
|
|
55
55
|
const V = {
|
|
56
56
|
maxCount: 10,
|
|
57
57
|
tipText: "上传",
|
|
@@ -70,62 +70,62 @@ const na = /* @__PURE__ */ ve({
|
|
|
70
70
|
enable: !0,
|
|
71
71
|
maxSize: 200,
|
|
72
72
|
allowedType: ["mp3", "m4a", "wav", "aac"]
|
|
73
|
-
}, R =
|
|
74
|
-
var
|
|
75
|
-
return ((o = (
|
|
76
|
-
}), D =
|
|
73
|
+
}, R = h(), x = h(), P = h(!1), T = h(!1), c = w(() => A([u.imageUploadOptions, C.imageUploadOptions, V]) || {}), m = w(() => A([u.videoUploadOptions, C.videoUploadOptions, B]) || {}), f = w(() => A([u.audioUploadOptions, C.audioUploadOptions, H]) || {}), U = w(() => A([u.imgPondOptions, C.imgPondOptions]) || {}), Y = w(() => {
|
|
74
|
+
var e, o;
|
|
75
|
+
return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
|
|
76
|
+
}), D = h();
|
|
77
77
|
S(() => D.value, () => {
|
|
78
78
|
if (D.value) {
|
|
79
|
-
let
|
|
80
|
-
|
|
79
|
+
let e;
|
|
80
|
+
J(D.value, {
|
|
81
81
|
onStart: () => {
|
|
82
|
-
|
|
82
|
+
e = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
|
|
83
83
|
},
|
|
84
84
|
onSuccess: () => {
|
|
85
|
-
|
|
85
|
+
e == null || e.close();
|
|
86
86
|
},
|
|
87
87
|
onError: (o) => {
|
|
88
|
-
|
|
88
|
+
e == null || e.close(), b.error(o);
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}, { immediate: !0 });
|
|
93
|
-
const M =
|
|
93
|
+
const M = h();
|
|
94
94
|
S(() => M.value, () => {
|
|
95
95
|
if (M.value) {
|
|
96
|
-
let
|
|
97
|
-
|
|
96
|
+
let e;
|
|
97
|
+
J(M.value, {
|
|
98
98
|
onStart: () => {
|
|
99
|
-
|
|
99
|
+
e = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
|
|
100
100
|
},
|
|
101
101
|
onSuccess: () => {
|
|
102
|
-
|
|
102
|
+
e == null || e.close();
|
|
103
103
|
},
|
|
104
104
|
onError: (o) => {
|
|
105
|
-
|
|
105
|
+
e == null || e.close(), b.error(o);
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}, { immediate: !0 });
|
|
110
|
-
const _ =
|
|
110
|
+
const _ = h({
|
|
111
111
|
dialogVisible: !1,
|
|
112
112
|
formData: {
|
|
113
113
|
images: []
|
|
114
114
|
}
|
|
115
|
-
}),
|
|
115
|
+
}), W = h(), j = () => {
|
|
116
116
|
_.value.dialogVisible = !1, _.value.formData = {
|
|
117
117
|
images: []
|
|
118
118
|
};
|
|
119
|
-
},
|
|
120
|
-
var
|
|
121
|
-
(
|
|
122
|
-
o && (_.value.formData.images.forEach((
|
|
123
|
-
var
|
|
124
|
-
let
|
|
125
|
-
U.value.srcAt && (
|
|
126
|
-
}),
|
|
119
|
+
}, Z = () => {
|
|
120
|
+
var e;
|
|
121
|
+
(e = W.value) == null || e.validate((o) => {
|
|
122
|
+
o && (_.value.formData.images.forEach((i) => {
|
|
123
|
+
var t;
|
|
124
|
+
let a = i;
|
|
125
|
+
U.value.srcAt && (a = (i == null ? void 0 : i[U.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
|
|
126
|
+
}), j());
|
|
127
127
|
});
|
|
128
|
-
}, p =
|
|
128
|
+
}, p = h({
|
|
129
129
|
dialogVisible: !1,
|
|
130
130
|
formData: {
|
|
131
131
|
// 名称
|
|
@@ -137,19 +137,19 @@ const na = /* @__PURE__ */ ve({
|
|
|
137
137
|
},
|
|
138
138
|
// 用于临时保存上传前的参数 { file: File }
|
|
139
139
|
additionalData: {}
|
|
140
|
-
}), $ =
|
|
140
|
+
}), $ = h(), I = () => {
|
|
141
141
|
p.value.dialogVisible = !1, p.value.formData = {
|
|
142
142
|
name: "",
|
|
143
143
|
cover: [],
|
|
144
144
|
file: []
|
|
145
145
|
}, p.value.additionalData = {};
|
|
146
|
-
},
|
|
147
|
-
var
|
|
148
|
-
(
|
|
149
|
-
var
|
|
150
|
-
o && ((
|
|
146
|
+
}, ee = () => {
|
|
147
|
+
var e;
|
|
148
|
+
(e = $.value) == null || e.validate((o) => {
|
|
149
|
+
var i, a;
|
|
150
|
+
o && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${p.value.formData.name}" data-poster="${p.value.formData.cover[0]}" src="${(i = p.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), I());
|
|
151
151
|
});
|
|
152
|
-
},
|
|
152
|
+
}, g = h({
|
|
153
153
|
dialogVisible: !1,
|
|
154
154
|
formData: {
|
|
155
155
|
// 文件
|
|
@@ -157,55 +157,56 @@ const na = /* @__PURE__ */ ve({
|
|
|
157
157
|
},
|
|
158
158
|
// 用于临时保存上传前的参数 { file: File }
|
|
159
159
|
additionalData: {}
|
|
160
|
-
}),
|
|
161
|
-
|
|
160
|
+
}), E = h(), q = () => {
|
|
161
|
+
g.value.dialogVisible = !1, g.value.formData = {
|
|
162
162
|
file: []
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
var
|
|
166
|
-
(
|
|
167
|
-
var
|
|
168
|
-
o && ((
|
|
163
|
+
}, g.value.additionalData = {};
|
|
164
|
+
}, ae = () => {
|
|
165
|
+
var e;
|
|
166
|
+
(e = E.value) == null || e.validate((o) => {
|
|
167
|
+
var i, a;
|
|
168
|
+
o && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(i = g.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), q());
|
|
169
169
|
});
|
|
170
|
-
},
|
|
171
|
-
var
|
|
172
|
-
const
|
|
173
|
-
if (!
|
|
174
|
-
|
|
175
|
-
o.onError(
|
|
170
|
+
}, te = (e, o) => new Promise(async (i, a) => {
|
|
171
|
+
var l, r;
|
|
172
|
+
const t = await K(e);
|
|
173
|
+
if (!t.success) {
|
|
174
|
+
a(), setTimeout(() => {
|
|
175
|
+
o.onError(t.errorMessage);
|
|
176
176
|
});
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
const
|
|
180
|
-
if (!
|
|
181
|
-
|
|
182
|
-
o.onError(
|
|
179
|
+
const n = await ((r = (l = c.value).handleRequest) == null ? void 0 : r.call(l, t.file, e.name, { extParameters: u.extParameters }));
|
|
180
|
+
if (!n || !(n != null && n.success)) {
|
|
181
|
+
a(), setTimeout(() => {
|
|
182
|
+
o.onError(n == null ? void 0 : n.errorMessage);
|
|
183
183
|
});
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
i(n.url);
|
|
187
187
|
});
|
|
188
|
-
async function
|
|
189
|
-
var
|
|
190
|
-
const o =
|
|
191
|
-
for (let
|
|
192
|
-
const r =
|
|
188
|
+
async function F(e) {
|
|
189
|
+
var i, a, t, n;
|
|
190
|
+
const o = e.getElementsByTagName("img");
|
|
191
|
+
for (let l of o) {
|
|
192
|
+
const r = l.src;
|
|
193
193
|
if (r.startsWith("http://") || r.startsWith("https://")) {
|
|
194
|
-
const s = await
|
|
195
|
-
if (s && (s.width < (
|
|
196
|
-
(
|
|
194
|
+
const s = await be(r);
|
|
195
|
+
if (s && (s.width < (c.value.minWidth || 0) && s.height < (c.value.minHeight || 0) || s.width > (c.value.maxWidth || 0) && s.height > (c.value.maxHeight || 0))) {
|
|
196
|
+
(i = l == null ? void 0 : l.remove) == null || i.call(l);
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
|
-
const d =
|
|
200
|
-
if (!((
|
|
201
|
-
(
|
|
199
|
+
const d = ye(r);
|
|
200
|
+
if (!((t = (a = c.value) == null ? void 0 : a.allowedType) != null && t.includes(d.toLowerCase()))) {
|
|
201
|
+
(n = l == null ? void 0 : l.remove) == null || n.call(l);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
ge(() => {
|
|
208
|
+
var i;
|
|
209
|
+
const e = {
|
|
209
210
|
// 设置语言
|
|
210
211
|
language: "zh_CN",
|
|
211
212
|
// 实例
|
|
@@ -284,90 +285,96 @@ const na = /* @__PURE__ */ ve({
|
|
|
284
285
|
convert_urls: !1,
|
|
285
286
|
paste_webkit_styles: "all",
|
|
286
287
|
paste_data_images: !0,
|
|
288
|
+
images_file_types: ((i = c.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
287
289
|
// 粘贴前处理
|
|
288
|
-
paste_preprocess(a,
|
|
289
|
-
|
|
290
|
+
paste_preprocess(a, t) {
|
|
291
|
+
t.content = t.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), t.content = t.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), t.content = t.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), t.content = t.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), t.content = t.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), t.content = t.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), t.content = t.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), t.content = t.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), t.content = t.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), t.content = t.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
|
|
290
292
|
},
|
|
291
293
|
// 粘贴后处理(处理异步操作)
|
|
292
|
-
paste_postprocess(a,
|
|
293
|
-
|
|
294
|
+
paste_postprocess(a, t) {
|
|
295
|
+
F(t.node);
|
|
294
296
|
},
|
|
295
297
|
images_upload_handler(a) {
|
|
296
|
-
return new Promise(async (
|
|
297
|
-
var
|
|
298
|
-
if (!((
|
|
299
|
-
return
|
|
300
|
-
const
|
|
301
|
-
let
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
return new Promise(async (t, n) => {
|
|
299
|
+
var N, O, G;
|
|
300
|
+
if (!((N = c.value) != null && N.handleRequest))
|
|
301
|
+
return n({ message: "缺少图片上传配置", remove: !0 });
|
|
302
|
+
const l = k.service({ text: "上传中" });
|
|
303
|
+
let r = a.blob(), s = r.name ? r.name : a.filename();
|
|
304
|
+
if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
|
|
305
|
+
return l == null || l.close(), n({ message: "不允许粘贴", remove: !0 });
|
|
306
|
+
const d = await xe(r, s, {
|
|
307
|
+
imageMaxSize: c.value.maxSize,
|
|
308
|
+
imageAllowedType: c.value.allowedType,
|
|
305
309
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
306
|
-
imageMinWidth:
|
|
307
|
-
imageMinHeight:
|
|
308
|
-
imageMaxWidth:
|
|
309
|
-
imageMaxHeight:
|
|
310
|
+
imageMinWidth: c.value.minWidth,
|
|
311
|
+
imageMinHeight: c.value.minHeight,
|
|
312
|
+
imageMaxWidth: c.value.maxWidth,
|
|
313
|
+
imageMaxHeight: c.value.maxHeight
|
|
310
314
|
});
|
|
311
|
-
if (s.success || (i == null || i.close(), l({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 })), s.hasTransform) {
|
|
312
|
-
const G = r == null ? void 0 : r.split(".");
|
|
313
|
-
G.pop(), r = `${G.join(",")}.jpeg`;
|
|
314
|
-
}
|
|
315
|
-
const d = await J(n);
|
|
316
315
|
if (!d.success)
|
|
317
|
-
return
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
316
|
+
return l == null || l.close(), n({ message: (d == null ? void 0 : d.errorMessage) || "", remove: !0 });
|
|
317
|
+
if (d.hasTransform) {
|
|
318
|
+
r = d.file;
|
|
319
|
+
const L = s == null ? void 0 : s.split(".");
|
|
320
|
+
L.pop(), s = `${L.join(",")}.jpeg`;
|
|
321
|
+
}
|
|
322
|
+
const v = await K(r);
|
|
323
|
+
if (!v.success)
|
|
324
|
+
return l == null || l.close(), n({ message: v == null ? void 0 : v.errorMessage, remove: !0 });
|
|
325
|
+
const y = await ((G = (O = c.value).handleRequest) == null ? void 0 : G.call(O, v.file, s, { extParameters: u.extParameters }));
|
|
326
|
+
if (!y || !y.success)
|
|
327
|
+
return l == null || l.close(), n({ message: y.errorMessage, remove: !0 });
|
|
328
|
+
l == null || l.close(), t(y.url);
|
|
322
329
|
});
|
|
323
330
|
},
|
|
324
331
|
setup(a) {
|
|
325
|
-
var
|
|
326
|
-
const
|
|
332
|
+
var n, l;
|
|
333
|
+
const t = () => {
|
|
327
334
|
_.value.dialogVisible = !0, setTimeout(() => {
|
|
328
|
-
var
|
|
329
|
-
const
|
|
330
|
-
|
|
335
|
+
var s, d;
|
|
336
|
+
const r = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
337
|
+
r && (r.innerHTML = ((d = c.value) == null ? void 0 : d.tipText) || "上传");
|
|
331
338
|
});
|
|
332
339
|
};
|
|
333
340
|
if (a.ui.registry.addMenuItem("localImage", {
|
|
334
341
|
text: "图片",
|
|
335
342
|
icon: "image",
|
|
336
|
-
onAction: () =>
|
|
343
|
+
onAction: () => t()
|
|
337
344
|
}), a.ui.registry.addButton("localImage", {
|
|
338
345
|
icon: "image",
|
|
339
346
|
tooltip: "图片",
|
|
340
|
-
onAction: () =>
|
|
341
|
-
}), (
|
|
342
|
-
const
|
|
347
|
+
onAction: () => t()
|
|
348
|
+
}), (n = f == null ? void 0 : f.value) != null && n.enable) {
|
|
349
|
+
const r = () => {
|
|
343
350
|
p.value.dialogVisible = !0, setTimeout(() => {
|
|
344
|
-
var
|
|
345
|
-
const
|
|
346
|
-
|
|
351
|
+
var d, v;
|
|
352
|
+
const s = (d = document == null ? void 0 : document.querySelector) == null ? void 0 : d.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
353
|
+
s && (s.innerHTML = ((v = c.value) == null ? void 0 : v.tipText) || "上传");
|
|
347
354
|
});
|
|
348
355
|
};
|
|
349
356
|
a.ui.registry.addMenuItem("localAudio", {
|
|
350
357
|
text: "音频",
|
|
351
358
|
icon: "arrow-right",
|
|
352
|
-
onAction: () =>
|
|
359
|
+
onAction: () => r()
|
|
353
360
|
}), a.ui.registry.addButton("localAudio", {
|
|
354
361
|
icon: "arrow-right",
|
|
355
362
|
tooltip: "音频",
|
|
356
|
-
onAction: () =>
|
|
363
|
+
onAction: () => r()
|
|
357
364
|
});
|
|
358
365
|
}
|
|
359
|
-
if ((
|
|
360
|
-
const
|
|
361
|
-
|
|
366
|
+
if ((l = m == null ? void 0 : m.value) != null && l.enable) {
|
|
367
|
+
const r = () => {
|
|
368
|
+
g.value.dialogVisible = !0;
|
|
362
369
|
};
|
|
363
370
|
a.ui.registry.addMenuItem("localVideo", {
|
|
364
371
|
text: "视频",
|
|
365
372
|
icon: "embed",
|
|
366
|
-
onAction: () =>
|
|
373
|
+
onAction: () => r()
|
|
367
374
|
}), a.ui.registry.addButton("localVideo", {
|
|
368
375
|
icon: "embed",
|
|
369
376
|
tooltip: "视频",
|
|
370
|
-
onAction: () =>
|
|
377
|
+
onAction: () => r()
|
|
371
378
|
});
|
|
372
379
|
}
|
|
373
380
|
}
|
|
@@ -375,103 +382,103 @@ const na = /* @__PURE__ */ ve({
|
|
|
375
382
|
[
|
|
376
383
|
u.options,
|
|
377
384
|
C.options,
|
|
378
|
-
|
|
385
|
+
e
|
|
379
386
|
],
|
|
380
387
|
{
|
|
381
|
-
mergeFunction: (a,
|
|
382
|
-
a(...
|
|
388
|
+
mergeFunction: (a, t) => (...n) => {
|
|
389
|
+
a(...n), t(...n);
|
|
383
390
|
},
|
|
384
391
|
type: Object
|
|
385
392
|
}
|
|
386
393
|
);
|
|
387
|
-
|
|
388
|
-
var
|
|
394
|
+
Q.init(o).then(([a]) => {
|
|
395
|
+
var t;
|
|
389
396
|
a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
|
|
390
397
|
if (T.value) {
|
|
391
398
|
T.value = !1;
|
|
392
399
|
return;
|
|
393
400
|
}
|
|
394
401
|
P.value = !0, z("input", a.getContent());
|
|
395
|
-
}), (
|
|
402
|
+
}), (t = u.initComplete) == null || t.call(u, { editorIns: a }), x.value = a);
|
|
396
403
|
});
|
|
397
|
-
}),
|
|
398
|
-
var
|
|
399
|
-
(
|
|
404
|
+
}), he(() => {
|
|
405
|
+
var e;
|
|
406
|
+
(e = x.value) == null || e.destroy();
|
|
400
407
|
});
|
|
401
|
-
const
|
|
402
|
-
var o,
|
|
403
|
-
const
|
|
404
|
-
return ((
|
|
405
|
-
},
|
|
406
|
-
var o,
|
|
407
|
-
const
|
|
408
|
-
return ((
|
|
409
|
-
},
|
|
410
|
-
var
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
},
|
|
414
|
-
var
|
|
415
|
-
const
|
|
416
|
-
if (!((
|
|
417
|
-
b.error(`请上传格式为${(s = (r =
|
|
408
|
+
const oe = () => {
|
|
409
|
+
var o, i;
|
|
410
|
+
const e = { ...p.value.additionalData || {} };
|
|
411
|
+
return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
|
|
412
|
+
}, ie = () => {
|
|
413
|
+
var o, i;
|
|
414
|
+
const e = { ...p.value.additionalData || {} };
|
|
415
|
+
return ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
|
|
416
|
+
}, le = (e, o, i) => {
|
|
417
|
+
var t, n;
|
|
418
|
+
const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
419
|
+
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), p.value.formData.file = i;
|
|
420
|
+
}, ne = (e, o) => new Promise((i, a) => {
|
|
421
|
+
var n, l, r, s, d, v;
|
|
422
|
+
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
423
|
+
if (!((l = (n = f.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
|
|
424
|
+
b.error(`请上传格式为${(s = (r = f.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
|
|
418
425
|
return;
|
|
419
426
|
}
|
|
420
|
-
if (
|
|
421
|
-
b.error(`请上传${((
|
|
427
|
+
if (e.size > (((d = f.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
|
|
428
|
+
b.error(`请上传${((v = f.value) == null ? void 0 : v.maxSize) || 0}M内的音频`), a();
|
|
422
429
|
return;
|
|
423
430
|
}
|
|
424
|
-
p.value.additionalData = { file:
|
|
425
|
-
}),
|
|
431
|
+
p.value.additionalData = { file: e }, i(!0);
|
|
432
|
+
}), re = (e, o) => {
|
|
426
433
|
p.value.formData.file = o;
|
|
427
|
-
},
|
|
428
|
-
b.error("上传发生错误,请重试!"), p.value.formData.file =
|
|
429
|
-
}, se = () => {
|
|
430
|
-
var o, a;
|
|
431
|
-
const t = { ...f.value.additionalData || {} };
|
|
432
|
-
return ((a = (o = c.value) == null ? void 0 : o.data) == null ? void 0 : a.call(o, { file: t, extParameters: u.extParameters })) || {};
|
|
434
|
+
}, se = (e, o, i) => {
|
|
435
|
+
b.error("上传发生错误,请重试!"), p.value.formData.file = i;
|
|
433
436
|
}, ue = () => {
|
|
434
|
-
var o,
|
|
435
|
-
const
|
|
436
|
-
return ((
|
|
437
|
-
}, ce = (
|
|
438
|
-
var
|
|
439
|
-
const e =
|
|
440
|
-
|
|
441
|
-
}, me = (
|
|
442
|
-
var
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
437
|
+
var o, i;
|
|
438
|
+
const e = { ...g.value.additionalData || {} };
|
|
439
|
+
return ((i = (o = m.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
|
|
440
|
+
}, ce = () => {
|
|
441
|
+
var o, i;
|
|
442
|
+
const e = { ...g.value.additionalData || {} };
|
|
443
|
+
return ((i = (o = m.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
|
|
444
|
+
}, me = (e, o, i) => {
|
|
445
|
+
var t, n;
|
|
446
|
+
const a = (n = (t = m == null ? void 0 : m.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
447
|
+
a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), g.value.formData.file = i;
|
|
448
|
+
}, de = (e, o) => new Promise((i, a) => {
|
|
449
|
+
var n, l, r, s, d, v;
|
|
450
|
+
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
451
|
+
if (!((l = (n = m == null ? void 0 : m.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
|
|
452
|
+
b.error(`请上传格式为${(s = (r = m == null ? void 0 : m.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
|
|
446
453
|
return;
|
|
447
454
|
}
|
|
448
|
-
if (
|
|
449
|
-
b.error(`请上传${((
|
|
455
|
+
if (e.size > (((d = m == null ? void 0 : m.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
|
|
456
|
+
b.error(`请上传${((v = m == null ? void 0 : m.value) == null ? void 0 : v.maxSize) || 0}M内的视频`), a();
|
|
450
457
|
return;
|
|
451
458
|
}
|
|
452
|
-
|
|
453
|
-
}),
|
|
454
|
-
|
|
455
|
-
},
|
|
456
|
-
b.error("上传发生错误,请重试!"),
|
|
459
|
+
g.value.additionalData = { file: e }, i(!0);
|
|
460
|
+
}), pe = (e, o) => {
|
|
461
|
+
g.value.formData.file = o;
|
|
462
|
+
}, ve = (e, o, i) => {
|
|
463
|
+
b.error("上传发生错误,请重试!"), g.value.formData.file = i;
|
|
457
464
|
};
|
|
458
|
-
return S(() => [u.disabled,
|
|
459
|
-
var
|
|
460
|
-
(o = (
|
|
465
|
+
return S(() => [u.disabled, x.value], () => {
|
|
466
|
+
var e, o;
|
|
467
|
+
(o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(u.disabled ? "readonly" : "design");
|
|
461
468
|
}, { immediate: !0 }), S(
|
|
462
|
-
() => [u.value,
|
|
469
|
+
() => [u.value, x.value],
|
|
463
470
|
() => {
|
|
464
|
-
var
|
|
471
|
+
var e;
|
|
465
472
|
if (P.value) {
|
|
466
473
|
P.value = !1;
|
|
467
474
|
return;
|
|
468
475
|
}
|
|
469
|
-
T.value = !0, (
|
|
476
|
+
T.value = !0, (e = x.value) == null || e.setContent(u.value ? u.value : "");
|
|
470
477
|
},
|
|
471
478
|
{ immediate: !0 }
|
|
472
|
-
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef:
|
|
479
|
+
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef: x, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: c, mergeVideoUploadOptions: m, mergeAudioUploadOptions: f, mergeImgPondOptions: U, imgPondAccept: Y, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: _, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: Z, uploadAudio: p, uploadAudioFormRef: $, onUploadAudioClose: I, onUploadAudioConfirm: ee, uploadVideo: g, uploadVideoFormRef: E, onUploadVideoClose: q, onUploadVideoConfirm: ae, onImageUploadUpload: te, processPastedImage: F, getUploadAudioData: oe, getUploadAudioHeaders: ie, onUploadAudioSuccess: le, onUploadAudioBeforeUpload: ne, onUploadAudioRemove: re, onUploadAudioError: se, getUploadVideoData: ue, getUploadVideoHeaders: ce, onUploadVideoSuccess: me, onUploadVideoBeforeUpload: de, onUploadVideoRemove: pe, onUploadVideoError: ve, ImgPond: _e };
|
|
473
480
|
}
|
|
474
481
|
});
|
|
475
482
|
export {
|
|
476
|
-
|
|
483
|
+
ra as default
|
|
477
484
|
};
|
package/package.json
CHANGED