@keyblade/tinymce-editor-vue2 0.0.12-alpha.50 → 0.0.12-alpha.51
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 +214 -202
- package/es/style.css +1 -1
- package/package.json +2 -2
package/es/editor.vue2.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImgPondBeforeAddFile as
|
|
3
|
-
import { blobToFile as
|
|
1
|
+
import { defineComponent as _e, ref as w, computed as C, watch as V, onMounted as De, onUnmounted as Ae } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as K, oneTravelImageCompressor as Q, oneTravelImageCheckAndTransform as Te } from "@keyblade/one-travel";
|
|
3
|
+
import { blobToFile as Y, getImagePixel as Ce, getFileExtension as Pe } from "./util.js";
|
|
4
4
|
import "./style.less.js";
|
|
5
|
-
import
|
|
6
|
-
import { conclude as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import Se from "imgpond";
|
|
6
|
+
import { conclude as P } from "vue-global-config";
|
|
7
|
+
import Z from "tinymce";
|
|
8
|
+
import Me 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 S } from "./index.js";
|
|
38
38
|
import { Message as p } from "element-ui";
|
|
39
|
-
const
|
|
39
|
+
const va = /* @__PURE__ */ _e({
|
|
40
40
|
__name: "editor",
|
|
41
41
|
props: {
|
|
42
42
|
value: { default: "" },
|
|
@@ -50,10 +50,10 @@ const pa = /* @__PURE__ */ be({
|
|
|
50
50
|
initComplete: null
|
|
51
51
|
},
|
|
52
52
|
emits: ["input"],
|
|
53
|
-
setup(
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
53
|
+
setup(ee, { emit: M }) {
|
|
54
|
+
const d = ee;
|
|
55
|
+
Z.addI18n("zh_CN", Me);
|
|
56
|
+
const B = {
|
|
57
57
|
maxCount: 10,
|
|
58
58
|
tipText: "上传",
|
|
59
59
|
maxSize: 30,
|
|
@@ -62,75 +62,75 @@ const pa = /* @__PURE__ */ be({
|
|
|
62
62
|
minHeight: 50,
|
|
63
63
|
maxWidth: 6e3,
|
|
64
64
|
maxHeight: 6e3
|
|
65
|
-
},
|
|
65
|
+
}, j = {
|
|
66
66
|
enable: !0,
|
|
67
67
|
maxSize: 300,
|
|
68
68
|
allowedType: ["mp4", "3gp"],
|
|
69
69
|
accept: "video/mp4,video/3gpp"
|
|
70
|
-
},
|
|
70
|
+
}, E = {
|
|
71
71
|
enable: !0,
|
|
72
72
|
maxSize: 200,
|
|
73
73
|
allowedType: ["mp3", "m4a", "wav", "aac"],
|
|
74
74
|
accept: "audio/mp3,audio/wav,audio/aac,audio/x-m4a"
|
|
75
|
-
},
|
|
75
|
+
}, $ = w(), g = w(), U = w(!1), k = w(!1), _ = w({
|
|
76
76
|
show: !1,
|
|
77
77
|
text: "图片上传中,请稍等"
|
|
78
|
-
}),
|
|
78
|
+
}), s = C(() => P([d.imageUploadOptions, S.imageUploadOptions, B]) || {}), c = C(() => P([d.videoUploadOptions, S.videoUploadOptions, j]) || {}), x = C(() => P([d.audioUploadOptions, S.audioUploadOptions, E]) || {}), H = C(() => P([d.imgPondOptions, S.imgPondOptions]) || {}), ae = C(() => {
|
|
79
79
|
var e, a;
|
|
80
|
-
return ((a = (e =
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
return ((a = (e = s == null ? void 0 : s.value) == null ? void 0 : e.allowedType) == null ? void 0 : a.map((o) => `.${o}`).join(",")) || "";
|
|
81
|
+
}), I = w();
|
|
82
|
+
V(() => I.value, () => {
|
|
83
|
+
I.value && K(I.value, {
|
|
84
84
|
onStart: () => {
|
|
85
|
-
|
|
85
|
+
_.value = {
|
|
86
86
|
show: !0,
|
|
87
87
|
text: "图片加载中,请稍等"
|
|
88
88
|
};
|
|
89
89
|
},
|
|
90
90
|
onSuccess: () => {
|
|
91
|
-
|
|
91
|
+
_.value.show = !1;
|
|
92
92
|
},
|
|
93
93
|
onError: (e) => {
|
|
94
|
-
|
|
94
|
+
_.value.show = !1, p.error({ message: e, customClass: "tinymce-editor-message", duration: 2e4 });
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}, { immediate: !0 });
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
const z = w();
|
|
99
|
+
V(() => z.value, () => {
|
|
100
|
+
z.value && K(z.value, {
|
|
101
101
|
onStart: () => {
|
|
102
|
-
|
|
102
|
+
_.value = {
|
|
103
103
|
show: !0,
|
|
104
104
|
text: "图片加载中,请稍等"
|
|
105
105
|
};
|
|
106
106
|
},
|
|
107
107
|
onSuccess: () => {
|
|
108
|
-
|
|
108
|
+
_.value.show = !1;
|
|
109
109
|
},
|
|
110
110
|
onError: (e) => {
|
|
111
|
-
|
|
111
|
+
_.value.show = !1, p.error(e);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
}, { immediate: !0 });
|
|
115
|
-
const A =
|
|
115
|
+
const A = w({
|
|
116
116
|
dialogVisible: !1,
|
|
117
117
|
formData: {
|
|
118
118
|
images: []
|
|
119
119
|
}
|
|
120
|
-
}),
|
|
121
|
-
A.value.dialogVisible = !1, A.value.formData = {
|
|
120
|
+
}), F = w(), R = () => {
|
|
121
|
+
T = [], A.value.dialogVisible = !1, A.value.formData = {
|
|
122
122
|
images: []
|
|
123
123
|
};
|
|
124
|
-
},
|
|
124
|
+
}, oe = () => {
|
|
125
125
|
var e;
|
|
126
|
-
(e =
|
|
126
|
+
T = [], (e = F.value) == null || e.validate((a) => {
|
|
127
127
|
a && (A.value.formData.images.forEach((o) => {
|
|
128
128
|
var i;
|
|
129
129
|
let t = o;
|
|
130
|
-
|
|
130
|
+
H.value.srcAt && (t = (o == null ? void 0 : o[H.value.srcAt]) || ""), (i = g.value) == null || i.insertContent(`<img src=${t} alt="" />`);
|
|
131
131
|
}), R());
|
|
132
132
|
});
|
|
133
|
-
},
|
|
133
|
+
}, h = w({
|
|
134
134
|
dialogVisible: !1,
|
|
135
135
|
formData: {
|
|
136
136
|
// 名称
|
|
@@ -142,19 +142,19 @@ const pa = /* @__PURE__ */ be({
|
|
|
142
142
|
},
|
|
143
143
|
// 用于临时保存上传前的参数 { file: File }
|
|
144
144
|
additionalData: {}
|
|
145
|
-
}), W =
|
|
146
|
-
|
|
145
|
+
}), W = w(), N = () => {
|
|
146
|
+
h.value.dialogVisible = !1, h.value.formData = {
|
|
147
147
|
name: "",
|
|
148
148
|
cover: [],
|
|
149
149
|
file: []
|
|
150
|
-
},
|
|
151
|
-
},
|
|
150
|
+
}, h.value.additionalData = {};
|
|
151
|
+
}, te = () => {
|
|
152
152
|
var e;
|
|
153
153
|
(e = W.value) == null || e.validate((a) => {
|
|
154
154
|
var o, t;
|
|
155
|
-
a && ((t =
|
|
155
|
+
a && ((t = g.value) == null || t.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${h.value.formData.name}" data-poster="${h.value.formData.cover[0]}" src="${(o = h.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), N());
|
|
156
156
|
});
|
|
157
|
-
},
|
|
157
|
+
}, b = w({
|
|
158
158
|
dialogVisible: !1,
|
|
159
159
|
formData: {
|
|
160
160
|
// 文件
|
|
@@ -162,144 +162,156 @@ const pa = /* @__PURE__ */ be({
|
|
|
162
162
|
},
|
|
163
163
|
// 用于临时保存上传前的参数 { file: File }
|
|
164
164
|
additionalData: {}
|
|
165
|
-
}),
|
|
166
|
-
|
|
165
|
+
}), O = w(), L = () => {
|
|
166
|
+
b.value.dialogVisible = !1, b.value.formData = {
|
|
167
167
|
file: []
|
|
168
|
-
},
|
|
169
|
-
},
|
|
168
|
+
}, b.value.additionalData = {};
|
|
169
|
+
}, ie = () => {
|
|
170
170
|
var e;
|
|
171
|
-
(e =
|
|
171
|
+
(e = O.value) == null || e.validate((a) => {
|
|
172
172
|
var o, t;
|
|
173
|
-
a && ((t =
|
|
173
|
+
a && ((t = g.value) == null || t.insertContent(`<video width="auto" height="auto" controls src="${(o = b.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), L());
|
|
174
174
|
});
|
|
175
|
-
},
|
|
175
|
+
}, re = () => {
|
|
176
176
|
document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
|
|
177
|
-
e && (e.innerHTML = `单次最多可选择${
|
|
177
|
+
e && (e.innerHTML = `单次最多可选择${s.value.maxCount}张图片`);
|
|
178
178
|
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
};
|
|
180
|
+
let T = [];
|
|
181
|
+
const le = (e, a) => new Promise(async (o, t) => {
|
|
182
|
+
var m, n;
|
|
183
|
+
if (T.find((l) => (l == null ? void 0 : l.uid) === (e == null ? void 0 : e.uid)))
|
|
184
|
+
return setTimeout(() => {
|
|
185
|
+
document.querySelectorAll(".swal2-container").forEach((l) => {
|
|
186
|
+
l == null || l.remove();
|
|
187
|
+
});
|
|
188
|
+
}), t("");
|
|
189
|
+
T.push(e);
|
|
190
|
+
const r = await Q(e);
|
|
191
|
+
if (!r.success) {
|
|
183
192
|
t(), setTimeout(() => {
|
|
184
|
-
a.onError(
|
|
193
|
+
a.onError(r.errorMessage);
|
|
185
194
|
});
|
|
186
195
|
return;
|
|
187
196
|
}
|
|
188
|
-
const
|
|
189
|
-
if (!
|
|
197
|
+
const u = await ((n = (m = s.value).handleRequest) == null ? void 0 : n.call(m, Y(r.file, e.name), e.name, { extParameters: d.extParameters }));
|
|
198
|
+
if (!u || !(u != null && u.success)) {
|
|
190
199
|
t(), setTimeout(() => {
|
|
191
|
-
a.onError(
|
|
200
|
+
a.onError(u == null ? void 0 : u.errorMessage);
|
|
192
201
|
});
|
|
193
202
|
return;
|
|
194
203
|
}
|
|
195
|
-
o(
|
|
204
|
+
o(u.url);
|
|
196
205
|
});
|
|
197
|
-
async function
|
|
198
|
-
var
|
|
206
|
+
async function G(e) {
|
|
207
|
+
var u, m, n;
|
|
199
208
|
let a = e;
|
|
200
|
-
if (!((
|
|
209
|
+
if (!((u = s.value) != null && u.handleRequest)) {
|
|
201
210
|
p.error("缺少图片上传配置");
|
|
202
211
|
return;
|
|
203
212
|
}
|
|
204
|
-
f.value = {
|
|
205
|
-
show: !0,
|
|
206
|
-
text: "图片上传中,请稍等"
|
|
207
|
-
};
|
|
208
213
|
let o = a.name ? a.name : "";
|
|
209
214
|
if (!(a != null && a.name) && !(a != null && a.lastModified) && a.type === "image/png") {
|
|
210
|
-
|
|
215
|
+
p.error("不允许粘贴");
|
|
211
216
|
return;
|
|
212
217
|
}
|
|
213
|
-
const t = await
|
|
214
|
-
imageMaxSize:
|
|
215
|
-
imageAllowedType:
|
|
218
|
+
const t = await Te(a, o, {
|
|
219
|
+
imageMaxSize: s.value.maxSize,
|
|
220
|
+
imageAllowedType: s.value.allowedType,
|
|
216
221
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
217
|
-
imageMinWidth:
|
|
218
|
-
imageMinHeight:
|
|
219
|
-
imageMaxWidth:
|
|
220
|
-
imageMaxHeight:
|
|
222
|
+
imageMinWidth: s.value.minWidth,
|
|
223
|
+
imageMinHeight: s.value.minHeight,
|
|
224
|
+
imageMaxWidth: s.value.maxWidth,
|
|
225
|
+
imageMaxHeight: s.value.maxHeight
|
|
221
226
|
});
|
|
222
227
|
if (!t.success) {
|
|
223
|
-
|
|
228
|
+
p.error((t == null ? void 0 : t.errorMessage) || "");
|
|
224
229
|
return;
|
|
225
230
|
}
|
|
226
231
|
if (t.hasTransform) {
|
|
227
232
|
a = t.file;
|
|
228
|
-
const
|
|
229
|
-
|
|
233
|
+
const l = o == null ? void 0 : o.split(".");
|
|
234
|
+
l.pop(), o = `${l.join(",")}.jpg`;
|
|
230
235
|
}
|
|
231
|
-
const i = await
|
|
236
|
+
const i = await Q(a);
|
|
232
237
|
if (!i.success) {
|
|
233
|
-
|
|
238
|
+
p.error((i == null ? void 0 : i.errorMessage) || "压缩失败");
|
|
234
239
|
return;
|
|
235
240
|
}
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
238
|
-
|
|
241
|
+
const r = await ((n = (m = s.value).handleRequest) == null ? void 0 : n.call(m, Y(i.file, o), o, { extParameters: d.extParameters }));
|
|
242
|
+
if (!r || !r.success) {
|
|
243
|
+
p.error((r == null ? void 0 : r.errorMessage) || "");
|
|
239
244
|
return;
|
|
240
245
|
}
|
|
241
|
-
return
|
|
246
|
+
return r.url;
|
|
242
247
|
}
|
|
243
|
-
const
|
|
244
|
-
var
|
|
245
|
-
const a =
|
|
248
|
+
const q = async (e) => {
|
|
249
|
+
var r, u, m;
|
|
250
|
+
const a = g.value, o = e.types;
|
|
246
251
|
if (o.includes("text/html")) {
|
|
247
|
-
const n = e.getData("text/html"),
|
|
248
|
-
|
|
252
|
+
const n = e.getData("text/html"), f = new DOMParser().parseFromString(n, "text/html"), D = Array.from(f.body.querySelectorAll("img")), we = Array.from(f.body.querySelectorAll("audio")), be = Array.from(f.body.querySelectorAll("video"));
|
|
253
|
+
D.length > 0 && (_.value = {
|
|
249
254
|
show: !0,
|
|
250
255
|
text: "图片加载中,请稍等"
|
|
251
256
|
});
|
|
252
|
-
for (const
|
|
253
|
-
|
|
254
|
-
for await (const
|
|
255
|
-
if (
|
|
256
|
-
if ((
|
|
257
|
-
const
|
|
258
|
-
|
|
257
|
+
for (const y of [...we, ...be])
|
|
258
|
+
y == null || y.remove();
|
|
259
|
+
for await (const y of [...D])
|
|
260
|
+
if (y.removeAttribute("crossorigin"), y.src.startsWith("http"))
|
|
261
|
+
if ((r = s.value) != null && r.handleRequestByUrl) {
|
|
262
|
+
const v = await ((u = s.value) == null ? void 0 : u.handleRequestByUrl(y.src, { extParameters: d.extParameters }));
|
|
263
|
+
v != null && v.success && (v != null && v.url) ? y.src = v == null ? void 0 : v.url : y.remove();
|
|
259
264
|
} else {
|
|
260
|
-
const
|
|
261
|
-
|
|
265
|
+
const v = await Ce(y.src);
|
|
266
|
+
v && (v.width < (s.value.minWidth || 0) && v.height < (s.value.minHeight || 0) || v.width > (s.value.maxWidth || 0) && v.height > (s.value.maxHeight || 0)) && y.remove();
|
|
262
267
|
}
|
|
263
268
|
else
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
a.insertContent(
|
|
269
|
+
y.remove(), p.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
270
|
+
_.value.show = !1;
|
|
271
|
+
const ye = new XMLSerializer().serializeToString(f.body);
|
|
272
|
+
a.insertContent(ye);
|
|
268
273
|
} else
|
|
269
274
|
o.includes("text/plain") && a.insertContent(e.getData("text/plain"));
|
|
270
|
-
const t = Array.from(e.
|
|
271
|
-
for
|
|
272
|
-
|
|
273
|
-
if (!d)
|
|
275
|
+
const t = Array.from((e == null ? void 0 : e.files) || []), i = [];
|
|
276
|
+
for (const n of t) {
|
|
277
|
+
if (!n)
|
|
274
278
|
continue;
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
279
|
+
const l = Pe(n.name);
|
|
280
|
+
n.type.indexOf("image") > -1 || (m = s.value.allowedType) != null && m.includes(l.toLowerCase()) ? i.push(n) : p.error("暂不支持的文件类型");
|
|
281
|
+
}
|
|
282
|
+
if (i.length > 0) {
|
|
283
|
+
_.value = {
|
|
284
|
+
show: !0,
|
|
285
|
+
text: "图片上传中,请稍等"
|
|
286
|
+
};
|
|
287
|
+
for await (const n of i) {
|
|
288
|
+
const l = await G(n);
|
|
289
|
+
if (l) {
|
|
290
|
+
const f = `<img src="${l}" alt="" />`;
|
|
291
|
+
a.insertContent(f);
|
|
281
292
|
}
|
|
282
293
|
}
|
|
294
|
+
_.value.show = !1;
|
|
283
295
|
}
|
|
284
296
|
M("input", a.getContent());
|
|
285
|
-
},
|
|
297
|
+
}, X = (e) => {
|
|
286
298
|
var o;
|
|
287
299
|
e.preventDefault();
|
|
288
300
|
const a = e.clipboardData || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.clipboardData);
|
|
289
|
-
|
|
290
|
-
},
|
|
301
|
+
q(a);
|
|
302
|
+
}, J = (e) => {
|
|
291
303
|
var o;
|
|
292
304
|
e.preventDefault();
|
|
293
305
|
const a = e.dataTransfer || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.dataTransfer);
|
|
294
|
-
|
|
306
|
+
q(a);
|
|
295
307
|
};
|
|
296
|
-
|
|
308
|
+
De(() => {
|
|
297
309
|
var o;
|
|
298
310
|
const e = {
|
|
299
311
|
// 设置语言
|
|
300
312
|
language: "zh_CN",
|
|
301
313
|
// 实例
|
|
302
|
-
target:
|
|
314
|
+
target: $.value,
|
|
303
315
|
// 隐藏品牌
|
|
304
316
|
branding: !1,
|
|
305
317
|
// 隐藏右上角升级按钮
|
|
@@ -377,18 +389,18 @@ const pa = /* @__PURE__ */ be({
|
|
|
377
389
|
convert_urls: !1,
|
|
378
390
|
paste_webkit_styles: "all",
|
|
379
391
|
paste_data_images: !1,
|
|
380
|
-
images_file_types: ((o =
|
|
392
|
+
images_file_types: ((o = s.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
381
393
|
// 粘贴前处理
|
|
382
394
|
paste_preprocess(t, i) {
|
|
383
395
|
i == null || i.preventDefault();
|
|
384
396
|
},
|
|
385
397
|
setup(t) {
|
|
386
|
-
var
|
|
398
|
+
var r, u;
|
|
387
399
|
const i = () => {
|
|
388
400
|
A.value.dialogVisible = !0, setTimeout(() => {
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
|
|
401
|
+
var n, l;
|
|
402
|
+
const m = (n = document == null ? void 0 : document.querySelector) == null ? void 0 : n.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
403
|
+
m && (m.innerHTML = ((l = s.value) == null ? void 0 : l.tipText) || "上传");
|
|
392
404
|
});
|
|
393
405
|
};
|
|
394
406
|
if (t.ui.registry.addMenuItem("localImage", {
|
|
@@ -399,146 +411,146 @@ const pa = /* @__PURE__ */ be({
|
|
|
399
411
|
icon: "image",
|
|
400
412
|
tooltip: "图片",
|
|
401
413
|
onAction: () => i()
|
|
402
|
-
}), (
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
var
|
|
406
|
-
const
|
|
407
|
-
|
|
414
|
+
}), (r = x == null ? void 0 : x.value) != null && r.enable) {
|
|
415
|
+
const m = () => {
|
|
416
|
+
h.value.dialogVisible = !0, setTimeout(() => {
|
|
417
|
+
var l, f;
|
|
418
|
+
const n = (l = document == null ? void 0 : document.querySelector) == null ? void 0 : l.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
419
|
+
n && (n.innerHTML = ((f = s.value) == null ? void 0 : f.tipText) || "上传");
|
|
408
420
|
});
|
|
409
421
|
};
|
|
410
422
|
t.ui.registry.addMenuItem("localAudio", {
|
|
411
423
|
text: "音频",
|
|
412
424
|
icon: "arrow-right",
|
|
413
|
-
onAction: () =>
|
|
425
|
+
onAction: () => m()
|
|
414
426
|
}), t.ui.registry.addButton("localAudio", {
|
|
415
427
|
icon: "arrow-right",
|
|
416
428
|
tooltip: "音频",
|
|
417
|
-
onAction: () =>
|
|
429
|
+
onAction: () => m()
|
|
418
430
|
});
|
|
419
431
|
}
|
|
420
|
-
if ((
|
|
421
|
-
const
|
|
422
|
-
|
|
432
|
+
if ((u = c == null ? void 0 : c.value) != null && u.enable) {
|
|
433
|
+
const m = () => {
|
|
434
|
+
b.value.dialogVisible = !0;
|
|
423
435
|
};
|
|
424
436
|
t.ui.registry.addMenuItem("localVideo", {
|
|
425
437
|
text: "视频",
|
|
426
438
|
icon: "embed",
|
|
427
|
-
onAction: () =>
|
|
439
|
+
onAction: () => m()
|
|
428
440
|
}), t.ui.registry.addButton("localVideo", {
|
|
429
441
|
icon: "embed",
|
|
430
442
|
tooltip: "视频",
|
|
431
|
-
onAction: () =>
|
|
443
|
+
onAction: () => m()
|
|
432
444
|
});
|
|
433
445
|
}
|
|
434
446
|
}
|
|
435
|
-
}, a =
|
|
447
|
+
}, a = P(
|
|
436
448
|
[
|
|
437
|
-
|
|
438
|
-
|
|
449
|
+
d.options,
|
|
450
|
+
S.options,
|
|
439
451
|
e
|
|
440
452
|
],
|
|
441
453
|
{
|
|
442
|
-
mergeFunction: (t, i) => (...
|
|
443
|
-
t(...
|
|
454
|
+
mergeFunction: (t, i) => (...r) => {
|
|
455
|
+
t(...r), i(...r);
|
|
444
456
|
},
|
|
445
457
|
type: Object
|
|
446
458
|
}
|
|
447
459
|
);
|
|
448
|
-
|
|
460
|
+
Z.init(a).then(([t]) => {
|
|
449
461
|
var i;
|
|
450
|
-
t && (t.customProps = { ...
|
|
462
|
+
t && (t.customProps = { ...d }, t.on("input", () => {
|
|
451
463
|
if (k.value) {
|
|
452
464
|
k.value = !1;
|
|
453
465
|
return;
|
|
454
466
|
}
|
|
455
|
-
|
|
467
|
+
U.value = !0, M("input", t.getContent());
|
|
456
468
|
}), t.on("change", () => {
|
|
457
469
|
M("input", t.getContent());
|
|
458
|
-
}), t.on("paste", (
|
|
459
|
-
|
|
460
|
-
}), t.on("drop", (
|
|
461
|
-
|
|
462
|
-
}), (i =
|
|
470
|
+
}), t.on("paste", (r) => {
|
|
471
|
+
X(r);
|
|
472
|
+
}), t.on("drop", (r) => {
|
|
473
|
+
J(r);
|
|
474
|
+
}), (i = d.initComplete) == null || i.call(d, { editorIns: t }), g.value = t);
|
|
463
475
|
});
|
|
464
|
-
}),
|
|
476
|
+
}), Ae(() => {
|
|
465
477
|
var e, a, o, t;
|
|
466
|
-
(e =
|
|
478
|
+
(e = g.value) == null || e.off("input"), (a = g.value) == null || a.off("paste"), (o = g.value) == null || o.off("drop"), (t = g.value) == null || t.destroy();
|
|
467
479
|
});
|
|
468
|
-
const
|
|
480
|
+
const ne = () => {
|
|
469
481
|
var a, o;
|
|
470
|
-
const e = { ...
|
|
471
|
-
return ((o = (a =
|
|
472
|
-
},
|
|
482
|
+
const e = { ...h.value.additionalData || {} };
|
|
483
|
+
return ((o = (a = x.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
484
|
+
}, se = () => {
|
|
473
485
|
var a, o;
|
|
474
|
-
const e = { ...
|
|
475
|
-
return ((o = (a =
|
|
476
|
-
},
|
|
477
|
-
var i,
|
|
478
|
-
const t = (
|
|
479
|
-
t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (p.error(t.errorMessage), o.splice(o.length - 1, 1)),
|
|
480
|
-
},
|
|
481
|
-
var
|
|
486
|
+
const e = { ...h.value.additionalData || {} };
|
|
487
|
+
return ((o = (a = x.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
488
|
+
}, ue = (e, a, o) => {
|
|
489
|
+
var i, r;
|
|
490
|
+
const t = (r = (i = x == null ? void 0 : x.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : r.call(i, e);
|
|
491
|
+
t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (p.error(t.errorMessage), o.splice(o.length - 1, 1)), h.value.formData.file = o;
|
|
492
|
+
}, me = (e, a) => new Promise((o, t) => {
|
|
493
|
+
var r, u, m, n, l, f;
|
|
482
494
|
const i = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
483
|
-
if (!((
|
|
484
|
-
p.error(`请上传格式为${(
|
|
495
|
+
if (!((u = (r = x.value) == null ? void 0 : r.allowedType) != null && u.includes(i.toLowerCase()))) {
|
|
496
|
+
p.error(`请上传格式为${(n = (m = x.value) == null ? void 0 : m.allowedType) == null ? void 0 : n.map((D) => D.toUpperCase()).join("、")}的音频`), t();
|
|
485
497
|
return;
|
|
486
498
|
}
|
|
487
|
-
if (e.size > (((
|
|
488
|
-
p.error(`请上传${((
|
|
499
|
+
if (e.size > (((l = x.value) == null ? void 0 : l.maxSize) || 0) * 1024 * 1024) {
|
|
500
|
+
p.error(`请上传${((f = x.value) == null ? void 0 : f.maxSize) || 0}M内的音频`), t();
|
|
489
501
|
return;
|
|
490
502
|
}
|
|
491
|
-
|
|
492
|
-
}),
|
|
493
|
-
|
|
494
|
-
},
|
|
495
|
-
p.error("上传发生错误,请重试!"),
|
|
496
|
-
}, ce = () => {
|
|
497
|
-
var a, o;
|
|
498
|
-
const e = { ...y.value.additionalData || {} };
|
|
499
|
-
return ((o = (a = u.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: s.extParameters })) || {};
|
|
503
|
+
h.value.additionalData = { file: e }, o(!0);
|
|
504
|
+
}), de = (e, a) => {
|
|
505
|
+
h.value.formData.file = a;
|
|
506
|
+
}, ce = (e, a, o) => {
|
|
507
|
+
p.error("上传发生错误,请重试!"), h.value.formData.file = o;
|
|
500
508
|
}, pe = () => {
|
|
501
509
|
var a, o;
|
|
502
|
-
const e = { ...
|
|
503
|
-
return ((o = (a =
|
|
504
|
-
}, fe = (
|
|
505
|
-
var
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
}, ve = (e, a
|
|
509
|
-
var
|
|
510
|
+
const e = { ...b.value.additionalData || {} };
|
|
511
|
+
return ((o = (a = c.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
512
|
+
}, fe = () => {
|
|
513
|
+
var a, o;
|
|
514
|
+
const e = { ...b.value.additionalData || {} };
|
|
515
|
+
return ((o = (a = c.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
516
|
+
}, ve = (e, a, o) => {
|
|
517
|
+
var i, r;
|
|
518
|
+
const t = (r = (i = c == null ? void 0 : c.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : r.call(i, e);
|
|
519
|
+
t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (p.error(t.errorMessage), o.splice(o.length - 1, 1)), b.value.formData.file = o;
|
|
520
|
+
}, ge = (e, a) => new Promise((o, t) => {
|
|
521
|
+
var r, u, m, n, l, f;
|
|
510
522
|
const i = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
511
|
-
if (!((
|
|
512
|
-
p.error(`请上传格式为${(
|
|
523
|
+
if (!((u = (r = c == null ? void 0 : c.value) == null ? void 0 : r.allowedType) != null && u.includes(i.toLowerCase()))) {
|
|
524
|
+
p.error(`请上传格式为${(n = (m = c == null ? void 0 : c.value) == null ? void 0 : m.allowedType) == null ? void 0 : n.map((D) => D.toUpperCase()).join("、")}的视频`), t();
|
|
513
525
|
return;
|
|
514
526
|
}
|
|
515
|
-
if (e.size > (((
|
|
516
|
-
p.error(`请上传${((
|
|
527
|
+
if (e.size > (((l = c == null ? void 0 : c.value) == null ? void 0 : l.maxSize) || 0) * 1024 * 1024) {
|
|
528
|
+
p.error(`请上传${((f = c == null ? void 0 : c.value) == null ? void 0 : f.maxSize) || 0}M内的视频`), t();
|
|
517
529
|
return;
|
|
518
530
|
}
|
|
519
|
-
|
|
520
|
-
}),
|
|
521
|
-
|
|
522
|
-
},
|
|
523
|
-
p.error("上传发生错误,请重试!"),
|
|
531
|
+
b.value.additionalData = { file: e }, o(!0);
|
|
532
|
+
}), he = (e, a) => {
|
|
533
|
+
b.value.formData.file = a;
|
|
534
|
+
}, xe = (e, a, o) => {
|
|
535
|
+
p.error("上传发生错误,请重试!"), b.value.formData.file = o;
|
|
524
536
|
};
|
|
525
|
-
return
|
|
537
|
+
return V(() => [d.disabled, g.value], () => {
|
|
526
538
|
var e, a;
|
|
527
|
-
(a = (e =
|
|
528
|
-
}, { immediate: !0 }),
|
|
529
|
-
() => [
|
|
539
|
+
(a = (e = g.value) == null ? void 0 : e.mode) == null || a.set(d.disabled ? "readonly" : "design");
|
|
540
|
+
}, { immediate: !0 }), V(
|
|
541
|
+
() => [d.value, g.value],
|
|
530
542
|
() => {
|
|
531
543
|
var e;
|
|
532
|
-
if (
|
|
533
|
-
|
|
544
|
+
if (U.value) {
|
|
545
|
+
U.value = !1;
|
|
534
546
|
return;
|
|
535
547
|
}
|
|
536
|
-
k.value = !0, (e =
|
|
548
|
+
k.value = !0, (e = g.value) == null || e.setContent(d.value ? d.value : "");
|
|
537
549
|
},
|
|
538
550
|
{ immediate: !0 }
|
|
539
|
-
), { __sfc: !0, defaultImageUploadOptions:
|
|
551
|
+
), { __sfc: !0, defaultImageUploadOptions: B, defaultVideoUploadOptions: j, defaultAudioUploadOptions: E, props: d, emits: M, insRef: $, editorRef: g, preventSettingContent: U, preventUpdatingModelValue: k, uploadLoadingConfig: _, mergeImageUploadOptions: s, mergeVideoUploadOptions: c, mergeAudioUploadOptions: x, mergeImgPondOptions: H, imgPondAccept: ae, uploadImageImgPondRef: I, audioImageImgPondRef: z, uploadImage: A, uploadImageFormRef: F, onUploadImageClose: R, onUploadImageConfirm: oe, uploadAudio: h, uploadAudioFormRef: W, onUploadAudioClose: N, onUploadAudioConfirm: te, uploadVideo: b, uploadVideoFormRef: O, onUploadVideoClose: L, onUploadVideoConfirm: ie, onImageUploadUploadExceed: re, imageUploadTempFiles: T, onImageUploadUpload: le, uploadPasteOrDropFile: G, handleDataTransfer: q, onValuePaste: X, onValueDrop: J, getUploadAudioData: ne, getUploadAudioHeaders: se, onUploadAudioSuccess: ue, onUploadAudioBeforeUpload: me, onUploadAudioRemove: de, onUploadAudioError: ce, getUploadVideoData: pe, getUploadVideoHeaders: fe, onUploadVideoSuccess: ve, onUploadVideoBeforeUpload: ge, onUploadVideoRemove: he, onUploadVideoError: xe, ImgPond: Se };
|
|
540
552
|
}
|
|
541
553
|
});
|
|
542
554
|
export {
|
|
543
|
-
|
|
555
|
+
va as default
|
|
544
556
|
};
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tox-tinymce-aux{z-index:10000!important}.tox-statusbar__branding{display:none!important}.tinymce-editor-dialog .el-dialog{min-width:600px}.tinymce-editor-upload-image-dialog .uploadImageForm{display:flex;align-content:center}.tinymce-editor-upload-image-dialog .uploadImageForm .tips{margin-left:20px;display:flex;flex-direction:column}.tinymce-editor-upload-image-dialog .uploadImageForm .tips>span{margin-bottom:16px}.tinymce-editor-dialog .upload-hide .el-upload,.tinymce-editor-dialog .upload-hide .el-upload__tip{display:none}.tinymce-editor-loading-dialog{z-index:4000!important}.tinymce-editor-loading-dialog .el-dialog{margin-top:calc(50vh - 107px);width:388px;min-width:auto!important;height:214px;background-image:linear-gradient(-72deg,#d8faff,#fff);box-shadow:0 2px 20px #00000012;border-radius:16px}.tinymce-editor-loading-dialog .el-dialog .el-dialog__header{display:none!important}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body{height:100%}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content span{margin-top:15px;font-size:16px;color:#1d2129;line-height:24px;font-weight:500}.tinymce-editor-spinner{width:60px;height:60px;position:relative;text-align:center;-webkit-animation:sk-rotate 2s infinite linear;animation:sk-rotate 2s infinite linear}.tinymce-editor-spinner-dot1,.tinymce-editor-spinner-dot2,.tinymce-editor-spinner-dot3{width:24px;height:24px;display:inline-block;position:absolute;top:0;background-color:#333;border-radius:100%;-webkit-animation:sk-bounce 2s infinite ease-in-out;animation:sk-bounce 2s infinite ease-in-out}.tinymce-editor-spinner-dot1{left:calc(50% - 12px);background-color:#5dff8e}.tinymce-editor-spinner-dot2{top:auto;bottom:0;right:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#21f4c7}.tinymce-editor-spinner-dot3{top:auto;bottom:0;left:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#98ff56}@-webkit-keyframes sk-rotate{to{-webkit-transform:rotate(360deg)}}@keyframes sk-rotate{to{transform:rotate(360deg);-webkit-transform:rotate(360deg)}}@-webkit-keyframes sk-bounce{0%,to{-webkit-transform:scale(0)}50%{-webkit-transform:scale(1)}}@keyframes sk-bounce{0%,to{transform:scale(0);-webkit-transform:scale(0)}50%{transform:scale(1);-webkit-transform:scale(1)}}.tinymce-editor-message{z-index:4000!important}
|
|
1
|
+
.tox-tinymce-aux{z-index:10000!important}.tox-statusbar__branding{display:none!important}.tinymce-editor-dialog .el-dialog{min-width:600px}.tinymce-editor-upload-image-dialog .uploadImageForm{display:flex;align-content:center}.tinymce-editor-upload-image-dialog .uploadImageForm .tips{margin-left:20px;display:flex;flex-direction:column}.tinymce-editor-upload-image-dialog .uploadImageForm .tips>span{margin-bottom:16px}.tinymce-editor-dialog .upload-hide .el-upload,.tinymce-editor-dialog .upload-hide .el-upload__tip{display:none}.tinymce-editor-loading-dialog{z-index:4000!important}.tinymce-editor-loading-dialog .el-dialog{margin-top:calc(50vh - 107px)!important;width:388px!important;min-width:auto!important;height:214px!important;background-image:linear-gradient(-72deg,#d8faff,#fff);box-shadow:0 2px 20px #00000012;border-radius:16px}.tinymce-editor-loading-dialog .el-dialog .el-dialog__header{display:none!important}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body{height:100%}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content span{margin-top:15px;font-size:16px;color:#1d2129;line-height:24px;font-weight:500}.tinymce-editor-spinner{width:60px;height:60px;position:relative;text-align:center;-webkit-animation:sk-rotate 2s infinite linear;animation:sk-rotate 2s infinite linear}.tinymce-editor-spinner-dot1,.tinymce-editor-spinner-dot2,.tinymce-editor-spinner-dot3{width:24px;height:24px;display:inline-block;position:absolute;top:0;background-color:#333;border-radius:100%;-webkit-animation:sk-bounce 2s infinite ease-in-out;animation:sk-bounce 2s infinite ease-in-out}.tinymce-editor-spinner-dot1{left:calc(50% - 12px);background-color:#5dff8e}.tinymce-editor-spinner-dot2{top:auto;bottom:0;right:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#21f4c7}.tinymce-editor-spinner-dot3{top:auto;bottom:0;left:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#98ff56}@-webkit-keyframes sk-rotate{to{-webkit-transform:rotate(360deg)}}@keyframes sk-rotate{to{transform:rotate(360deg);-webkit-transform:rotate(360deg)}}@-webkit-keyframes sk-bounce{0%,to{-webkit-transform:scale(0)}50%{-webkit-transform:scale(1)}}@keyframes sk-bounce{0%,to{transform:scale(0);-webkit-transform:scale(0)}50%{transform:scale(1);-webkit-transform:scale(1)}}.tinymce-editor-message{z-index:4000!important}.el-dialog__wrapper>div[aria-label=编辑图片] .el-dialog__footer>div>:nth-child(2)>span.el-tag{display:none}
|
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.51",
|
|
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.16"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^2.7.0",
|