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