@keyblade/tinymce-editor-vue2 0.0.12-alpha.35 → 0.0.12-alpha.37
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 +166 -164
- package/package.json +2 -2
package/es/editor.vue2.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import { blobToFile as
|
|
1
|
+
import { defineComponent as he, ref as h, computed as T, watch as I, onMounted as xe, onUnmounted as we } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as G, oneTravelImageCheckAndTransform as be, oneTravelImageCompressor as J } from "@keyblade/one-travel";
|
|
3
|
+
import { blobToFile as K, getFileExtension as Q, getImagePixel as ye } from "./util.js";
|
|
4
4
|
import "./style.less.js";
|
|
5
|
-
import
|
|
6
|
-
import { conclude as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import _e from "imgpond";
|
|
6
|
+
import { conclude as A } from "vue-global-config";
|
|
7
|
+
import X from "tinymce";
|
|
8
|
+
import Te from "./langs/zh_CN.js";
|
|
9
9
|
import "tinymce/skins/ui/oxide/skin";
|
|
10
10
|
import "tinymce/models/dom";
|
|
11
11
|
import "tinymce/themes/silver";
|
|
@@ -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 C } from "./index.js";
|
|
38
38
|
import { Message as b } from "element-ui";
|
|
39
|
-
const
|
|
39
|
+
const ua = /* @__PURE__ */ he({
|
|
40
40
|
__name: "editor",
|
|
41
41
|
props: {
|
|
42
42
|
value: { default: "" },
|
|
@@ -50,9 +50,9 @@ const da = /* @__PURE__ */ xe({
|
|
|
50
50
|
initComplete: null
|
|
51
51
|
},
|
|
52
52
|
emits: ["input"],
|
|
53
|
-
setup(
|
|
54
|
-
const m =
|
|
55
|
-
|
|
53
|
+
setup(Y, { emit: k }) {
|
|
54
|
+
const m = Y;
|
|
55
|
+
X.addI18n("zh_CN", Te);
|
|
56
56
|
const z = {
|
|
57
57
|
maxCount: 10,
|
|
58
58
|
tipText: "上传",
|
|
@@ -63,23 +63,23 @@ const da = /* @__PURE__ */ xe({
|
|
|
63
63
|
minHeight: 50,
|
|
64
64
|
maxWidth: 6e3,
|
|
65
65
|
maxHeight: 6e3
|
|
66
|
-
},
|
|
66
|
+
}, H = {
|
|
67
67
|
enable: !0,
|
|
68
68
|
maxSize: 300,
|
|
69
69
|
allowedType: ["mp4", "3gp"]
|
|
70
|
-
},
|
|
70
|
+
}, V = {
|
|
71
71
|
enable: !0,
|
|
72
72
|
maxSize: 200,
|
|
73
73
|
allowedType: ["mp3", "m4a", "wav", "aac"]
|
|
74
|
-
},
|
|
74
|
+
}, B = h(), w = h(), P = h(!1), D = h(!1), f = h({
|
|
75
75
|
show: !1,
|
|
76
76
|
text: "图片上传中,请稍等"
|
|
77
|
-
}), d =
|
|
78
|
-
var
|
|
79
|
-
return ((i = (
|
|
80
|
-
}),
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
}), d = T(() => A([m.imageUploadOptions, C.imageUploadOptions, z]) || {}), c = T(() => A([m.videoUploadOptions, C.videoUploadOptions, H]) || {}), g = T(() => A([m.audioUploadOptions, C.audioUploadOptions, V]) || {}), U = T(() => A([m.imgPondOptions, C.imgPondOptions]) || {}), Z = T(() => {
|
|
78
|
+
var e, i;
|
|
79
|
+
return ((i = (e = d == null ? void 0 : d.value) == null ? void 0 : e.allowedType) == null ? void 0 : i.map((o) => `.${o}`).join(",")) || "";
|
|
80
|
+
}), M = h();
|
|
81
|
+
I(() => M.value, () => {
|
|
82
|
+
M.value && G(M.value, {
|
|
83
83
|
onStart: () => {
|
|
84
84
|
f.value = {
|
|
85
85
|
show: !0,
|
|
@@ -89,14 +89,14 @@ const da = /* @__PURE__ */ xe({
|
|
|
89
89
|
onSuccess: () => {
|
|
90
90
|
f.value.show = !1;
|
|
91
91
|
},
|
|
92
|
-
onError: (
|
|
93
|
-
f.value.show = !1, b.error(
|
|
92
|
+
onError: (e) => {
|
|
93
|
+
f.value.show = !1, b.error(e);
|
|
94
94
|
}
|
|
95
|
-
})
|
|
95
|
+
});
|
|
96
96
|
}, { immediate: !0 });
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
const S = h();
|
|
98
|
+
I(() => S.value, () => {
|
|
99
|
+
S.value && G(S.value, {
|
|
100
100
|
onStart: () => {
|
|
101
101
|
f.value = {
|
|
102
102
|
show: !0,
|
|
@@ -106,27 +106,27 @@ const da = /* @__PURE__ */ xe({
|
|
|
106
106
|
onSuccess: () => {
|
|
107
107
|
f.value.show = !1;
|
|
108
108
|
},
|
|
109
|
-
onError: (
|
|
110
|
-
f.value.show = !1, b.error(
|
|
109
|
+
onError: (e) => {
|
|
110
|
+
f.value.show = !1, b.error(e);
|
|
111
111
|
}
|
|
112
|
-
})
|
|
112
|
+
});
|
|
113
113
|
}, { immediate: !0 });
|
|
114
|
-
const
|
|
114
|
+
const _ = h({
|
|
115
115
|
dialogVisible: !1,
|
|
116
116
|
formData: {
|
|
117
117
|
images: []
|
|
118
118
|
}
|
|
119
119
|
}), R = h(), W = () => {
|
|
120
|
-
|
|
120
|
+
_.value.dialogVisible = !1, _.value.formData = {
|
|
121
121
|
images: []
|
|
122
122
|
};
|
|
123
|
-
},
|
|
124
|
-
var
|
|
125
|
-
(
|
|
126
|
-
i && (
|
|
127
|
-
var
|
|
128
|
-
let
|
|
129
|
-
U.value.srcAt && (
|
|
123
|
+
}, ee = () => {
|
|
124
|
+
var e;
|
|
125
|
+
(e = R.value) == null || e.validate((i) => {
|
|
126
|
+
i && (_.value.formData.images.forEach((o) => {
|
|
127
|
+
var t;
|
|
128
|
+
let a = o;
|
|
129
|
+
U.value.srcAt && (a = (o == null ? void 0 : o[U.value.srcAt]) || ""), (t = w.value) == null || t.insertContent(`<img src=${a} alt="" />`);
|
|
130
130
|
}), W());
|
|
131
131
|
});
|
|
132
132
|
}, v = h({
|
|
@@ -147,11 +147,11 @@ const da = /* @__PURE__ */ xe({
|
|
|
147
147
|
cover: [],
|
|
148
148
|
file: []
|
|
149
149
|
}, v.value.additionalData = {};
|
|
150
|
-
},
|
|
151
|
-
var
|
|
152
|
-
(
|
|
153
|
-
var
|
|
154
|
-
i && ((
|
|
150
|
+
}, ae = () => {
|
|
151
|
+
var e;
|
|
152
|
+
(e = E.value) == null || e.validate((i) => {
|
|
153
|
+
var o, a;
|
|
154
|
+
i && ((a = w.value) == null || a.insertContent(`<audio controls data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(o = v.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), $());
|
|
155
155
|
});
|
|
156
156
|
}, x = h({
|
|
157
157
|
dialogVisible: !1,
|
|
@@ -166,59 +166,61 @@ const da = /* @__PURE__ */ xe({
|
|
|
166
166
|
file: []
|
|
167
167
|
}, x.value.additionalData = {};
|
|
168
168
|
}, te = () => {
|
|
169
|
-
var
|
|
170
|
-
(
|
|
171
|
-
var
|
|
172
|
-
i && ((
|
|
169
|
+
var e;
|
|
170
|
+
(e = j.value) == null || e.validate((i) => {
|
|
171
|
+
var o, a;
|
|
172
|
+
i && ((a = w.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(o = x.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), q());
|
|
173
|
+
});
|
|
174
|
+
}, oe = () => {
|
|
175
|
+
document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
|
|
176
|
+
e && (e.innerHTML = `单次最多可选择${d.value.maxCount}张图片`);
|
|
173
177
|
});
|
|
174
|
-
}, ie = () => {
|
|
175
|
-
b.error(`单次最多可选择${d.value.maxCount}张图片`);
|
|
176
|
-
}, le = (a, i) => new Promise(async (t, e) => {
|
|
178
|
+
}, ie = (e, i) => new Promise(async (o, a) => {
|
|
177
179
|
var r, l;
|
|
178
|
-
const
|
|
179
|
-
if (!
|
|
180
|
-
|
|
181
|
-
i.onError(
|
|
180
|
+
const t = await J(e);
|
|
181
|
+
if (!t.success) {
|
|
182
|
+
a(), setTimeout(() => {
|
|
183
|
+
i.onError(t.errorMessage);
|
|
182
184
|
});
|
|
183
185
|
return;
|
|
184
186
|
}
|
|
185
|
-
const n = await ((l = (r = d.value).handleRequest) == null ? void 0 : l.call(r,
|
|
187
|
+
const n = await ((l = (r = d.value).handleRequest) == null ? void 0 : l.call(r, K(t.file, e.name), e.name, { extParameters: m.extParameters }));
|
|
186
188
|
if (!n || !(n != null && n.success)) {
|
|
187
|
-
|
|
189
|
+
a(), setTimeout(() => {
|
|
188
190
|
i.onError(n == null ? void 0 : n.errorMessage);
|
|
189
191
|
});
|
|
190
192
|
return;
|
|
191
193
|
}
|
|
192
|
-
|
|
194
|
+
o(n.url);
|
|
193
195
|
});
|
|
194
|
-
async function F(
|
|
195
|
-
var
|
|
196
|
-
const i =
|
|
196
|
+
async function F(e) {
|
|
197
|
+
var o, a, t, n, r;
|
|
198
|
+
const i = e.getElementsByTagName("img");
|
|
197
199
|
for (let l of i) {
|
|
198
200
|
const s = l.src;
|
|
199
201
|
if (s.startsWith("data:image"))
|
|
200
|
-
(
|
|
202
|
+
(o = l == null ? void 0 : l.remove) == null || o.call(l);
|
|
201
203
|
else if (s.startsWith("http://") || s.startsWith("https://")) {
|
|
202
|
-
const u = await
|
|
204
|
+
const u = await ye(s);
|
|
203
205
|
if (u && (u.width < (d.value.minWidth || 0) && u.height < (d.value.minHeight || 0) || u.width > (d.value.maxWidth || 0) && u.height > (d.value.maxHeight || 0))) {
|
|
204
|
-
(
|
|
206
|
+
(a = l == null ? void 0 : l.remove) == null || a.call(l);
|
|
205
207
|
return;
|
|
206
208
|
}
|
|
207
|
-
const p =
|
|
208
|
-
if (!((n = (
|
|
209
|
+
const p = Q(s);
|
|
210
|
+
if (!((n = (t = d.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
|
|
209
211
|
(r = l == null ? void 0 : l.remove) == null || r.call(l);
|
|
210
212
|
return;
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
|
-
|
|
216
|
-
var
|
|
217
|
-
const
|
|
217
|
+
xe(() => {
|
|
218
|
+
var o;
|
|
219
|
+
const e = {
|
|
218
220
|
// 设置语言
|
|
219
221
|
language: "zh_CN",
|
|
220
222
|
// 实例
|
|
221
|
-
target:
|
|
223
|
+
target: B.value,
|
|
222
224
|
// 隐藏品牌
|
|
223
225
|
branding: !1,
|
|
224
226
|
// 隐藏右上角升级按钮
|
|
@@ -293,28 +295,28 @@ const da = /* @__PURE__ */ xe({
|
|
|
293
295
|
convert_urls: !1,
|
|
294
296
|
paste_webkit_styles: "all",
|
|
295
297
|
paste_data_images: !0,
|
|
296
|
-
images_file_types: ((
|
|
298
|
+
images_file_types: ((o = d.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
297
299
|
// 粘贴前处理
|
|
298
|
-
paste_preprocess(
|
|
299
|
-
|
|
300
|
+
paste_preprocess(a, t) {
|
|
301
|
+
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>");
|
|
300
302
|
},
|
|
301
303
|
// 粘贴后处理(处理异步操作)
|
|
302
|
-
paste_postprocess(
|
|
303
|
-
F(
|
|
304
|
+
paste_postprocess(a, t) {
|
|
305
|
+
F(t.node);
|
|
304
306
|
},
|
|
305
|
-
images_upload_handler(
|
|
306
|
-
return new Promise(async (
|
|
307
|
-
var
|
|
308
|
-
if (!((
|
|
307
|
+
images_upload_handler(a) {
|
|
308
|
+
return new Promise(async (t, n) => {
|
|
309
|
+
var y, N, O;
|
|
310
|
+
if (!((y = d.value) != null && y.handleRequest))
|
|
309
311
|
return n({ message: "缺少图片上传配置", remove: !0 });
|
|
310
312
|
f.value = {
|
|
311
313
|
show: !0,
|
|
312
314
|
text: "图片上传中,请稍等"
|
|
313
315
|
};
|
|
314
|
-
let r =
|
|
316
|
+
let r = a.blob(), l = r.name ? r.name : a.filename();
|
|
315
317
|
if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
|
|
316
318
|
return f.value.show = !1, n({ message: "不允许粘贴", remove: !0 });
|
|
317
|
-
const s = await
|
|
319
|
+
const s = await be(r, l, {
|
|
318
320
|
imageMaxSize: d.value.maxSize,
|
|
319
321
|
imageAllowedType: d.value.allowedType,
|
|
320
322
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
@@ -330,32 +332,32 @@ const da = /* @__PURE__ */ xe({
|
|
|
330
332
|
const L = l == null ? void 0 : l.split(".");
|
|
331
333
|
L.pop(), l = `${L.join(",")}.jpg`;
|
|
332
334
|
}
|
|
333
|
-
const u = await
|
|
335
|
+
const u = await J(r);
|
|
334
336
|
if (!u.success)
|
|
335
337
|
return f.value.show = !1, n({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
|
|
336
|
-
const p = await ((O = (N = d.value).handleRequest) == null ? void 0 : O.call(N,
|
|
338
|
+
const p = await ((O = (N = d.value).handleRequest) == null ? void 0 : O.call(N, K(u.file, l), l, { extParameters: m.extParameters }));
|
|
337
339
|
if (!p || !p.success)
|
|
338
340
|
return f.value.show = !1, n({ message: p.errorMessage, remove: !0 });
|
|
339
|
-
f.value.show = !1,
|
|
341
|
+
f.value.show = !1, t(p.url);
|
|
340
342
|
});
|
|
341
343
|
},
|
|
342
|
-
setup(
|
|
344
|
+
setup(a) {
|
|
343
345
|
var n, r;
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
+
const t = () => {
|
|
347
|
+
_.value.dialogVisible = !0, setTimeout(() => {
|
|
346
348
|
var s, u;
|
|
347
349
|
const l = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
348
350
|
l && (l.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
|
|
349
351
|
});
|
|
350
352
|
};
|
|
351
|
-
if (
|
|
353
|
+
if (a.ui.registry.addMenuItem("localImage", {
|
|
352
354
|
text: "图片",
|
|
353
355
|
icon: "image",
|
|
354
|
-
onAction: () =>
|
|
355
|
-
}),
|
|
356
|
+
onAction: () => t()
|
|
357
|
+
}), a.ui.registry.addButton("localImage", {
|
|
356
358
|
icon: "image",
|
|
357
359
|
tooltip: "图片",
|
|
358
|
-
onAction: () =>
|
|
360
|
+
onAction: () => t()
|
|
359
361
|
}), (n = g == null ? void 0 : g.value) != null && n.enable) {
|
|
360
362
|
const l = () => {
|
|
361
363
|
v.value.dialogVisible = !0, setTimeout(() => {
|
|
@@ -364,11 +366,11 @@ const da = /* @__PURE__ */ xe({
|
|
|
364
366
|
s && (s.innerHTML = ((p = d.value) == null ? void 0 : p.tipText) || "上传");
|
|
365
367
|
});
|
|
366
368
|
};
|
|
367
|
-
|
|
369
|
+
a.ui.registry.addMenuItem("localAudio", {
|
|
368
370
|
text: "音频",
|
|
369
371
|
icon: "arrow-right",
|
|
370
372
|
onAction: () => l()
|
|
371
|
-
}),
|
|
373
|
+
}), a.ui.registry.addButton("localAudio", {
|
|
372
374
|
icon: "arrow-right",
|
|
373
375
|
tooltip: "音频",
|
|
374
376
|
onAction: () => l()
|
|
@@ -378,125 +380,125 @@ const da = /* @__PURE__ */ xe({
|
|
|
378
380
|
const l = () => {
|
|
379
381
|
x.value.dialogVisible = !0;
|
|
380
382
|
};
|
|
381
|
-
|
|
383
|
+
a.ui.registry.addMenuItem("localVideo", {
|
|
382
384
|
text: "视频",
|
|
383
385
|
icon: "embed",
|
|
384
386
|
onAction: () => l()
|
|
385
|
-
}),
|
|
387
|
+
}), a.ui.registry.addButton("localVideo", {
|
|
386
388
|
icon: "embed",
|
|
387
389
|
tooltip: "视频",
|
|
388
390
|
onAction: () => l()
|
|
389
391
|
});
|
|
390
392
|
}
|
|
391
393
|
}
|
|
392
|
-
}, i =
|
|
394
|
+
}, i = A(
|
|
393
395
|
[
|
|
394
396
|
m.options,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
+
C.options,
|
|
398
|
+
e
|
|
397
399
|
],
|
|
398
400
|
{
|
|
399
|
-
mergeFunction: (
|
|
400
|
-
|
|
401
|
+
mergeFunction: (a, t) => (...n) => {
|
|
402
|
+
a(...n), t(...n);
|
|
401
403
|
},
|
|
402
404
|
type: Object
|
|
403
405
|
}
|
|
404
406
|
);
|
|
405
|
-
|
|
406
|
-
var
|
|
407
|
-
|
|
408
|
-
if (
|
|
409
|
-
|
|
407
|
+
X.init(i).then(([a]) => {
|
|
408
|
+
var t;
|
|
409
|
+
a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
|
|
410
|
+
if (D.value) {
|
|
411
|
+
D.value = !1;
|
|
410
412
|
return;
|
|
411
413
|
}
|
|
412
|
-
|
|
413
|
-
}),
|
|
414
|
+
P.value = !0, k("input", a.getContent());
|
|
415
|
+
}), a.on("paste", (n) => {
|
|
414
416
|
var l, s;
|
|
415
417
|
const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
|
|
416
418
|
for (let u of r) {
|
|
417
|
-
const p =
|
|
419
|
+
const p = Q(u.name) || "";
|
|
418
420
|
(s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
|
|
419
421
|
}
|
|
420
|
-
}), (
|
|
422
|
+
}), (t = m.initComplete) == null || t.call(m, { editorIns: a }), w.value = a);
|
|
421
423
|
});
|
|
422
424
|
}), we(() => {
|
|
423
|
-
var
|
|
424
|
-
(
|
|
425
|
+
var e;
|
|
426
|
+
(e = w.value) == null || e.destroy();
|
|
425
427
|
});
|
|
426
|
-
const
|
|
427
|
-
var i,
|
|
428
|
-
const
|
|
429
|
-
return ((
|
|
430
|
-
},
|
|
431
|
-
var i,
|
|
432
|
-
const
|
|
433
|
-
return ((
|
|
434
|
-
},
|
|
435
|
-
var
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
},
|
|
428
|
+
const le = () => {
|
|
429
|
+
var i, o;
|
|
430
|
+
const e = { ...v.value.additionalData || {} };
|
|
431
|
+
return ((o = (i = g.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { file: e, extParameters: m.extParameters })) || {};
|
|
432
|
+
}, ne = () => {
|
|
433
|
+
var i, o;
|
|
434
|
+
const e = { ...v.value.additionalData || {} };
|
|
435
|
+
return ((o = (i = g.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { file: e, extParameters: m.extParameters })) || {};
|
|
436
|
+
}, re = (e, i, o) => {
|
|
437
|
+
var t, n;
|
|
438
|
+
const a = (n = (t = g == null ? void 0 : g.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
439
|
+
a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), o.splice(o.length - 1, 1)), v.value.formData.file = o;
|
|
440
|
+
}, se = (e, i) => new Promise((o, a) => {
|
|
439
441
|
var n, r, l, s, u, p;
|
|
440
|
-
const
|
|
441
|
-
if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(
|
|
442
|
-
b.error(`请上传格式为${(s = (l = g.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((
|
|
442
|
+
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
443
|
+
if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
444
|
+
b.error(`请上传格式为${(s = (l = g.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
|
|
443
445
|
return;
|
|
444
446
|
}
|
|
445
|
-
if (
|
|
446
|
-
b.error(`请上传${((p = g.value) == null ? void 0 : p.maxSize) || 0}M内的音频`),
|
|
447
|
+
if (e.size > (((u = g.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
448
|
+
b.error(`请上传${((p = g.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
|
|
447
449
|
return;
|
|
448
450
|
}
|
|
449
|
-
v.value.additionalData = { file:
|
|
450
|
-
}),
|
|
451
|
+
v.value.additionalData = { file: e }, o(!0);
|
|
452
|
+
}), ue = (e, i) => {
|
|
451
453
|
v.value.formData.file = i;
|
|
452
|
-
},
|
|
453
|
-
b.error("上传发生错误,请重试!"), v.value.formData.file =
|
|
454
|
+
}, de = (e, i, o) => {
|
|
455
|
+
b.error("上传发生错误,请重试!"), v.value.formData.file = o;
|
|
456
|
+
}, me = () => {
|
|
457
|
+
var i, o;
|
|
458
|
+
const e = { ...x.value.additionalData || {} };
|
|
459
|
+
return ((o = (i = c.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { file: e, extParameters: m.extParameters })) || {};
|
|
454
460
|
}, ce = () => {
|
|
455
|
-
var i,
|
|
456
|
-
const
|
|
457
|
-
return ((
|
|
458
|
-
}, pe = () => {
|
|
459
|
-
var
|
|
460
|
-
const a =
|
|
461
|
-
|
|
462
|
-
}, ve = (
|
|
463
|
-
var o, n;
|
|
464
|
-
const e = (n = (o = c == null ? void 0 : c.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, a);
|
|
465
|
-
e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (b.error(e.errorMessage), t.splice(t.length - 1, 1)), x.value.formData.file = t;
|
|
466
|
-
}, fe = (a, i) => new Promise((t, e) => {
|
|
461
|
+
var i, o;
|
|
462
|
+
const e = { ...x.value.additionalData || {} };
|
|
463
|
+
return ((o = (i = c.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { file: e, extParameters: m.extParameters })) || {};
|
|
464
|
+
}, pe = (e, i, o) => {
|
|
465
|
+
var t, n;
|
|
466
|
+
const a = (n = (t = c == null ? void 0 : c.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
467
|
+
a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), o.splice(o.length - 1, 1)), x.value.formData.file = o;
|
|
468
|
+
}, ve = (e, i) => new Promise((o, a) => {
|
|
467
469
|
var n, r, l, s, u, p;
|
|
468
|
-
const
|
|
469
|
-
if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(
|
|
470
|
-
b.error(`请上传格式为${(s = (l = c == null ? void 0 : c.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((
|
|
470
|
+
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
471
|
+
if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
472
|
+
b.error(`请上传格式为${(s = (l = c == null ? void 0 : c.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
|
|
471
473
|
return;
|
|
472
474
|
}
|
|
473
|
-
if (
|
|
474
|
-
b.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`),
|
|
475
|
+
if (e.size > (((u = c == null ? void 0 : c.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
476
|
+
b.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
|
|
475
477
|
return;
|
|
476
478
|
}
|
|
477
|
-
x.value.additionalData = { file:
|
|
478
|
-
}),
|
|
479
|
+
x.value.additionalData = { file: e }, o(!0);
|
|
480
|
+
}), fe = (e, i) => {
|
|
479
481
|
x.value.formData.file = i;
|
|
480
|
-
},
|
|
481
|
-
b.error("上传发生错误,请重试!"), x.value.formData.file =
|
|
482
|
+
}, ge = (e, i, o) => {
|
|
483
|
+
b.error("上传发生错误,请重试!"), x.value.formData.file = o;
|
|
482
484
|
};
|
|
483
|
-
return
|
|
484
|
-
var
|
|
485
|
-
(i = (
|
|
486
|
-
}, { immediate: !0 }),
|
|
485
|
+
return I(() => [m.disabled, w.value], () => {
|
|
486
|
+
var e, i;
|
|
487
|
+
(i = (e = w.value) == null ? void 0 : e.mode) == null || i.set(m.disabled ? "readonly" : "design");
|
|
488
|
+
}, { immediate: !0 }), I(
|
|
487
489
|
() => [m.value, w.value],
|
|
488
490
|
() => {
|
|
489
|
-
var
|
|
490
|
-
if (
|
|
491
|
-
|
|
491
|
+
var e;
|
|
492
|
+
if (P.value) {
|
|
493
|
+
P.value = !1;
|
|
492
494
|
return;
|
|
493
495
|
}
|
|
494
|
-
|
|
496
|
+
D.value = !0, (e = w.value) == null || e.setContent(m.value ? m.value : "");
|
|
495
497
|
},
|
|
496
498
|
{ immediate: !0 }
|
|
497
|
-
), { __sfc: !0, defaultImageUploadOptions: z, defaultVideoUploadOptions:
|
|
499
|
+
), { __sfc: !0, defaultImageUploadOptions: z, defaultVideoUploadOptions: H, defaultAudioUploadOptions: V, props: m, emits: k, insRef: B, editorRef: w, preventSettingContent: P, preventUpdatingModelValue: D, uploadLoadingConfig: f, mergeImageUploadOptions: d, mergeVideoUploadOptions: c, mergeAudioUploadOptions: g, mergeImgPondOptions: U, imgPondAccept: Z, uploadImageImgPondRef: M, audioImageImgPondRef: S, uploadImage: _, uploadImageFormRef: R, onUploadImageClose: W, onUploadImageConfirm: ee, uploadAudio: v, uploadAudioFormRef: E, onUploadAudioClose: $, onUploadAudioConfirm: ae, uploadVideo: x, uploadVideoFormRef: j, onUploadVideoClose: q, onUploadVideoConfirm: te, onImageUploadUploadExceed: oe, onImageUploadUpload: ie, processPastedImage: F, getUploadAudioData: le, getUploadAudioHeaders: ne, onUploadAudioSuccess: re, onUploadAudioBeforeUpload: se, onUploadAudioRemove: ue, onUploadAudioError: de, getUploadVideoData: me, getUploadVideoHeaders: ce, onUploadVideoSuccess: pe, onUploadVideoBeforeUpload: ve, onUploadVideoRemove: fe, onUploadVideoError: ge, ImgPond: _e };
|
|
498
500
|
}
|
|
499
501
|
});
|
|
500
502
|
export {
|
|
501
|
-
|
|
503
|
+
ua as default
|
|
502
504
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@keyblade/tinymce-editor-vue2",
|
|
3
3
|
"description": "KeyBlade Tinymce Editor Vue2",
|
|
4
4
|
"author": "yangshuai <704807396@qq.com>",
|
|
5
|
-
"version": "0.0.12-alpha.
|
|
5
|
+
"version": "0.0.12-alpha.37",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "es/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"vue-global-config": "^0.2.6",
|
|
24
24
|
"tinymce": "^7.1.0",
|
|
25
25
|
"element-ui": "^2.15.14",
|
|
26
|
-
"@keyblade/one-travel": "^2.0.
|
|
26
|
+
"@keyblade/one-travel": "^2.0.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^2.7.0",
|