@keyblade/tinymce-editor-vue2 0.0.12-alpha.50 → 0.0.12-alpha.52
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 +217 -203
- 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";
|
|
@@ -20,6 +20,8 @@ import "tinymce/plugins/directionality";
|
|
|
20
20
|
import "tinymce/plugins/emoticons";
|
|
21
21
|
import "tinymce/plugins/emoticons/js/emojis.min";
|
|
22
22
|
import "tinymce/plugins/fullscreen";
|
|
23
|
+
import "tinymce/plugins/help";
|
|
24
|
+
import "tinymce/plugins/help/js/i18n/keynav/zh_CN";
|
|
23
25
|
import "tinymce/plugins/image";
|
|
24
26
|
import "tinymce/plugins/insertdatetime";
|
|
25
27
|
import "tinymce/plugins/link";
|
|
@@ -34,9 +36,9 @@ import "tinymce/plugins/table";
|
|
|
34
36
|
import "tinymce/plugins/visualblocks";
|
|
35
37
|
import "tinymce/plugins/visualchars";
|
|
36
38
|
import "tinymce/plugins/wordcount";
|
|
37
|
-
import { globalProps as
|
|
39
|
+
import { globalProps as S } from "./index.js";
|
|
38
40
|
import { Message as p } from "element-ui";
|
|
39
|
-
const
|
|
41
|
+
const ha = /* @__PURE__ */ _e({
|
|
40
42
|
__name: "editor",
|
|
41
43
|
props: {
|
|
42
44
|
value: { default: "" },
|
|
@@ -50,10 +52,10 @@ const pa = /* @__PURE__ */ be({
|
|
|
50
52
|
initComplete: null
|
|
51
53
|
},
|
|
52
54
|
emits: ["input"],
|
|
53
|
-
setup(
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
const
|
|
55
|
+
setup(ee, { emit: M }) {
|
|
56
|
+
const d = ee;
|
|
57
|
+
Z.addI18n("zh_CN", Me);
|
|
58
|
+
const B = {
|
|
57
59
|
maxCount: 10,
|
|
58
60
|
tipText: "上传",
|
|
59
61
|
maxSize: 30,
|
|
@@ -62,75 +64,75 @@ const pa = /* @__PURE__ */ be({
|
|
|
62
64
|
minHeight: 50,
|
|
63
65
|
maxWidth: 6e3,
|
|
64
66
|
maxHeight: 6e3
|
|
65
|
-
},
|
|
67
|
+
}, j = {
|
|
66
68
|
enable: !0,
|
|
67
69
|
maxSize: 300,
|
|
68
70
|
allowedType: ["mp4", "3gp"],
|
|
69
71
|
accept: "video/mp4,video/3gpp"
|
|
70
|
-
},
|
|
72
|
+
}, E = {
|
|
71
73
|
enable: !0,
|
|
72
74
|
maxSize: 200,
|
|
73
75
|
allowedType: ["mp3", "m4a", "wav", "aac"],
|
|
74
76
|
accept: "audio/mp3,audio/wav,audio/aac,audio/x-m4a"
|
|
75
|
-
},
|
|
77
|
+
}, $ = w(), g = w(), U = w(!1), k = w(!1), _ = w({
|
|
76
78
|
show: !1,
|
|
77
79
|
text: "图片上传中,请稍等"
|
|
78
|
-
}),
|
|
80
|
+
}), 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
81
|
var e, a;
|
|
80
|
-
return ((a = (e =
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
return ((a = (e = s == null ? void 0 : s.value) == null ? void 0 : e.allowedType) == null ? void 0 : a.map((o) => `.${o}`).join(",")) || "";
|
|
83
|
+
}), I = w();
|
|
84
|
+
V(() => I.value, () => {
|
|
85
|
+
I.value && K(I.value, {
|
|
84
86
|
onStart: () => {
|
|
85
|
-
|
|
87
|
+
_.value = {
|
|
86
88
|
show: !0,
|
|
87
89
|
text: "图片加载中,请稍等"
|
|
88
90
|
};
|
|
89
91
|
},
|
|
90
92
|
onSuccess: () => {
|
|
91
|
-
|
|
93
|
+
_.value.show = !1;
|
|
92
94
|
},
|
|
93
95
|
onError: (e) => {
|
|
94
|
-
|
|
96
|
+
_.value.show = !1, p.error({ message: e, customClass: "tinymce-editor-message", duration: 2e4 });
|
|
95
97
|
}
|
|
96
98
|
});
|
|
97
99
|
}, { immediate: !0 });
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
const z = w();
|
|
101
|
+
V(() => z.value, () => {
|
|
102
|
+
z.value && K(z.value, {
|
|
101
103
|
onStart: () => {
|
|
102
|
-
|
|
104
|
+
_.value = {
|
|
103
105
|
show: !0,
|
|
104
106
|
text: "图片加载中,请稍等"
|
|
105
107
|
};
|
|
106
108
|
},
|
|
107
109
|
onSuccess: () => {
|
|
108
|
-
|
|
110
|
+
_.value.show = !1;
|
|
109
111
|
},
|
|
110
112
|
onError: (e) => {
|
|
111
|
-
|
|
113
|
+
_.value.show = !1, p.error(e);
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
116
|
}, { immediate: !0 });
|
|
115
|
-
const A =
|
|
117
|
+
const A = w({
|
|
116
118
|
dialogVisible: !1,
|
|
117
119
|
formData: {
|
|
118
120
|
images: []
|
|
119
121
|
}
|
|
120
|
-
}),
|
|
121
|
-
A.value.dialogVisible = !1, A.value.formData = {
|
|
122
|
+
}), F = w(), R = () => {
|
|
123
|
+
T = [], A.value.dialogVisible = !1, A.value.formData = {
|
|
122
124
|
images: []
|
|
123
125
|
};
|
|
124
|
-
},
|
|
126
|
+
}, oe = () => {
|
|
125
127
|
var e;
|
|
126
|
-
(e =
|
|
128
|
+
T = [], (e = F.value) == null || e.validate((a) => {
|
|
127
129
|
a && (A.value.formData.images.forEach((o) => {
|
|
128
130
|
var i;
|
|
129
131
|
let t = o;
|
|
130
|
-
|
|
132
|
+
H.value.srcAt && (t = (o == null ? void 0 : o[H.value.srcAt]) || ""), (i = g.value) == null || i.insertContent(`<img src=${t} alt="" />`);
|
|
131
133
|
}), R());
|
|
132
134
|
});
|
|
133
|
-
},
|
|
135
|
+
}, h = w({
|
|
134
136
|
dialogVisible: !1,
|
|
135
137
|
formData: {
|
|
136
138
|
// 名称
|
|
@@ -142,19 +144,19 @@ const pa = /* @__PURE__ */ be({
|
|
|
142
144
|
},
|
|
143
145
|
// 用于临时保存上传前的参数 { file: File }
|
|
144
146
|
additionalData: {}
|
|
145
|
-
}), W =
|
|
146
|
-
|
|
147
|
+
}), W = w(), N = () => {
|
|
148
|
+
h.value.dialogVisible = !1, h.value.formData = {
|
|
147
149
|
name: "",
|
|
148
150
|
cover: [],
|
|
149
151
|
file: []
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
+
}, h.value.additionalData = {};
|
|
153
|
+
}, te = () => {
|
|
152
154
|
var e;
|
|
153
155
|
(e = W.value) == null || e.validate((a) => {
|
|
154
156
|
var o, t;
|
|
155
|
-
a && ((t =
|
|
157
|
+
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
158
|
});
|
|
157
|
-
},
|
|
159
|
+
}, b = w({
|
|
158
160
|
dialogVisible: !1,
|
|
159
161
|
formData: {
|
|
160
162
|
// 文件
|
|
@@ -162,144 +164,156 @@ const pa = /* @__PURE__ */ be({
|
|
|
162
164
|
},
|
|
163
165
|
// 用于临时保存上传前的参数 { file: File }
|
|
164
166
|
additionalData: {}
|
|
165
|
-
}),
|
|
166
|
-
|
|
167
|
+
}), O = w(), L = () => {
|
|
168
|
+
b.value.dialogVisible = !1, b.value.formData = {
|
|
167
169
|
file: []
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
+
}, b.value.additionalData = {};
|
|
171
|
+
}, ie = () => {
|
|
170
172
|
var e;
|
|
171
|
-
(e =
|
|
173
|
+
(e = O.value) == null || e.validate((a) => {
|
|
172
174
|
var o, t;
|
|
173
|
-
a && ((t =
|
|
175
|
+
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
176
|
});
|
|
175
|
-
},
|
|
177
|
+
}, re = () => {
|
|
176
178
|
document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
|
|
177
|
-
e && (e.innerHTML = `单次最多可选择${
|
|
179
|
+
e && (e.innerHTML = `单次最多可选择${s.value.maxCount}张图片`);
|
|
178
180
|
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
};
|
|
182
|
+
let T = [];
|
|
183
|
+
const le = (e, a) => new Promise(async (o, t) => {
|
|
184
|
+
var m, n;
|
|
185
|
+
if (T.find((l) => (l == null ? void 0 : l.uid) === (e == null ? void 0 : e.uid)))
|
|
186
|
+
return setTimeout(() => {
|
|
187
|
+
document.querySelectorAll(".swal2-container").forEach((l) => {
|
|
188
|
+
l == null || l.remove();
|
|
189
|
+
});
|
|
190
|
+
}), t("");
|
|
191
|
+
T.push(e);
|
|
192
|
+
const r = await Q(e);
|
|
193
|
+
if (!r.success) {
|
|
183
194
|
t(), setTimeout(() => {
|
|
184
|
-
a.onError(
|
|
195
|
+
a.onError(r.errorMessage);
|
|
185
196
|
});
|
|
186
197
|
return;
|
|
187
198
|
}
|
|
188
|
-
const
|
|
189
|
-
if (!
|
|
199
|
+
const u = await ((n = (m = s.value).handleRequest) == null ? void 0 : n.call(m, Y(r.file, e.name), e.name, { extParameters: d.extParameters }));
|
|
200
|
+
if (!u || !(u != null && u.success)) {
|
|
190
201
|
t(), setTimeout(() => {
|
|
191
|
-
a.onError(
|
|
202
|
+
a.onError(u == null ? void 0 : u.errorMessage);
|
|
192
203
|
});
|
|
193
204
|
return;
|
|
194
205
|
}
|
|
195
|
-
o(
|
|
206
|
+
o(u.url);
|
|
196
207
|
});
|
|
197
|
-
async function
|
|
198
|
-
var
|
|
208
|
+
async function G(e) {
|
|
209
|
+
var u, m, n;
|
|
199
210
|
let a = e;
|
|
200
|
-
if (!((
|
|
211
|
+
if (!((u = s.value) != null && u.handleRequest)) {
|
|
201
212
|
p.error("缺少图片上传配置");
|
|
202
213
|
return;
|
|
203
214
|
}
|
|
204
|
-
f.value = {
|
|
205
|
-
show: !0,
|
|
206
|
-
text: "图片上传中,请稍等"
|
|
207
|
-
};
|
|
208
215
|
let o = a.name ? a.name : "";
|
|
209
216
|
if (!(a != null && a.name) && !(a != null && a.lastModified) && a.type === "image/png") {
|
|
210
|
-
|
|
217
|
+
p.error("不允许粘贴");
|
|
211
218
|
return;
|
|
212
219
|
}
|
|
213
|
-
const t = await
|
|
214
|
-
imageMaxSize:
|
|
215
|
-
imageAllowedType:
|
|
220
|
+
const t = await Te(a, o, {
|
|
221
|
+
imageMaxSize: s.value.maxSize,
|
|
222
|
+
imageAllowedType: s.value.allowedType,
|
|
216
223
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
217
|
-
imageMinWidth:
|
|
218
|
-
imageMinHeight:
|
|
219
|
-
imageMaxWidth:
|
|
220
|
-
imageMaxHeight:
|
|
224
|
+
imageMinWidth: s.value.minWidth,
|
|
225
|
+
imageMinHeight: s.value.minHeight,
|
|
226
|
+
imageMaxWidth: s.value.maxWidth,
|
|
227
|
+
imageMaxHeight: s.value.maxHeight
|
|
221
228
|
});
|
|
222
229
|
if (!t.success) {
|
|
223
|
-
|
|
230
|
+
p.error((t == null ? void 0 : t.errorMessage) || "");
|
|
224
231
|
return;
|
|
225
232
|
}
|
|
226
233
|
if (t.hasTransform) {
|
|
227
234
|
a = t.file;
|
|
228
|
-
const
|
|
229
|
-
|
|
235
|
+
const l = o == null ? void 0 : o.split(".");
|
|
236
|
+
l.pop(), o = `${l.join(",")}.jpg`;
|
|
230
237
|
}
|
|
231
|
-
const i = await
|
|
238
|
+
const i = await Q(a);
|
|
232
239
|
if (!i.success) {
|
|
233
|
-
|
|
240
|
+
p.error((i == null ? void 0 : i.errorMessage) || "压缩失败");
|
|
234
241
|
return;
|
|
235
242
|
}
|
|
236
|
-
const
|
|
237
|
-
if (!
|
|
238
|
-
|
|
243
|
+
const r = await ((n = (m = s.value).handleRequest) == null ? void 0 : n.call(m, Y(i.file, o), o, { extParameters: d.extParameters }));
|
|
244
|
+
if (!r || !r.success) {
|
|
245
|
+
p.error((r == null ? void 0 : r.errorMessage) || "");
|
|
239
246
|
return;
|
|
240
247
|
}
|
|
241
|
-
return
|
|
248
|
+
return r.url;
|
|
242
249
|
}
|
|
243
|
-
const
|
|
244
|
-
var
|
|
245
|
-
const a =
|
|
250
|
+
const q = async (e) => {
|
|
251
|
+
var r, u, m;
|
|
252
|
+
const a = g.value, o = e.types;
|
|
246
253
|
if (o.includes("text/html")) {
|
|
247
|
-
const n = e.getData("text/html"),
|
|
248
|
-
|
|
254
|
+
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"));
|
|
255
|
+
D.length > 0 && (_.value = {
|
|
249
256
|
show: !0,
|
|
250
257
|
text: "图片加载中,请稍等"
|
|
251
258
|
});
|
|
252
|
-
for (const
|
|
253
|
-
|
|
254
|
-
for await (const
|
|
255
|
-
if (
|
|
256
|
-
if ((
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
+
for (const y of [...we, ...be])
|
|
260
|
+
y == null || y.remove();
|
|
261
|
+
for await (const y of [...D])
|
|
262
|
+
if (y.removeAttribute("crossorigin"), y.src.startsWith("http"))
|
|
263
|
+
if ((r = s.value) != null && r.handleRequestByUrl) {
|
|
264
|
+
const v = await ((u = s.value) == null ? void 0 : u.handleRequestByUrl(y.src, { extParameters: d.extParameters }));
|
|
265
|
+
v != null && v.success && (v != null && v.url) ? y.src = v == null ? void 0 : v.url : y.remove();
|
|
259
266
|
} else {
|
|
260
|
-
const
|
|
261
|
-
|
|
267
|
+
const v = await Ce(y.src);
|
|
268
|
+
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
269
|
}
|
|
263
270
|
else
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
a.insertContent(
|
|
271
|
+
y.remove(), p.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
272
|
+
_.value.show = !1;
|
|
273
|
+
const ye = new XMLSerializer().serializeToString(f.body);
|
|
274
|
+
a.insertContent(ye);
|
|
268
275
|
} else
|
|
269
276
|
o.includes("text/plain") && a.insertContent(e.getData("text/plain"));
|
|
270
|
-
const t = Array.from(e.
|
|
271
|
-
for
|
|
272
|
-
|
|
273
|
-
if (!d)
|
|
277
|
+
const t = Array.from((e == null ? void 0 : e.files) || []), i = [];
|
|
278
|
+
for (const n of t) {
|
|
279
|
+
if (!n)
|
|
274
280
|
continue;
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
const l = Pe(n.name);
|
|
282
|
+
n.type.indexOf("image") > -1 || (m = s.value.allowedType) != null && m.includes(l.toLowerCase()) ? i.push(n) : p.error("暂不支持的文件类型");
|
|
283
|
+
}
|
|
284
|
+
if (i.length > 0) {
|
|
285
|
+
_.value = {
|
|
286
|
+
show: !0,
|
|
287
|
+
text: "图片上传中,请稍等"
|
|
288
|
+
};
|
|
289
|
+
for await (const n of i) {
|
|
290
|
+
const l = await G(n);
|
|
291
|
+
if (l) {
|
|
292
|
+
const f = `<img src="${l}" alt="" />`;
|
|
293
|
+
a.insertContent(f);
|
|
281
294
|
}
|
|
282
295
|
}
|
|
296
|
+
_.value.show = !1;
|
|
283
297
|
}
|
|
284
298
|
M("input", a.getContent());
|
|
285
|
-
},
|
|
299
|
+
}, X = (e) => {
|
|
286
300
|
var o;
|
|
287
301
|
e.preventDefault();
|
|
288
302
|
const a = e.clipboardData || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.clipboardData);
|
|
289
|
-
|
|
290
|
-
},
|
|
303
|
+
q(a);
|
|
304
|
+
}, J = (e) => {
|
|
291
305
|
var o;
|
|
292
306
|
e.preventDefault();
|
|
293
307
|
const a = e.dataTransfer || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.dataTransfer);
|
|
294
|
-
|
|
308
|
+
q(a);
|
|
295
309
|
};
|
|
296
|
-
|
|
310
|
+
De(() => {
|
|
297
311
|
var o;
|
|
298
312
|
const e = {
|
|
299
313
|
// 设置语言
|
|
300
314
|
language: "zh_CN",
|
|
301
315
|
// 实例
|
|
302
|
-
target:
|
|
316
|
+
target: $.value,
|
|
303
317
|
// 隐藏品牌
|
|
304
318
|
branding: !1,
|
|
305
319
|
// 隐藏右上角升级按钮
|
|
@@ -334,7 +348,7 @@ const pa = /* @__PURE__ */ be({
|
|
|
334
348
|
"directionality",
|
|
335
349
|
"emoticons",
|
|
336
350
|
"fullscreen",
|
|
337
|
-
|
|
351
|
+
"help",
|
|
338
352
|
"image",
|
|
339
353
|
// 'importcss'
|
|
340
354
|
"insertdatetime",
|
|
@@ -377,18 +391,18 @@ const pa = /* @__PURE__ */ be({
|
|
|
377
391
|
convert_urls: !1,
|
|
378
392
|
paste_webkit_styles: "all",
|
|
379
393
|
paste_data_images: !1,
|
|
380
|
-
images_file_types: ((o =
|
|
394
|
+
images_file_types: ((o = s.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
381
395
|
// 粘贴前处理
|
|
382
396
|
paste_preprocess(t, i) {
|
|
383
397
|
i == null || i.preventDefault();
|
|
384
398
|
},
|
|
385
399
|
setup(t) {
|
|
386
|
-
var
|
|
400
|
+
var r, u;
|
|
387
401
|
const i = () => {
|
|
388
402
|
A.value.dialogVisible = !0, setTimeout(() => {
|
|
389
|
-
var
|
|
390
|
-
const
|
|
391
|
-
|
|
403
|
+
var n, l;
|
|
404
|
+
const m = (n = document == null ? void 0 : document.querySelector) == null ? void 0 : n.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
405
|
+
m && (m.innerHTML = ((l = s.value) == null ? void 0 : l.tipText) || "上传");
|
|
392
406
|
});
|
|
393
407
|
};
|
|
394
408
|
if (t.ui.registry.addMenuItem("localImage", {
|
|
@@ -399,146 +413,146 @@ const pa = /* @__PURE__ */ be({
|
|
|
399
413
|
icon: "image",
|
|
400
414
|
tooltip: "图片",
|
|
401
415
|
onAction: () => i()
|
|
402
|
-
}), (
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
var
|
|
406
|
-
const
|
|
407
|
-
|
|
416
|
+
}), (r = x == null ? void 0 : x.value) != null && r.enable) {
|
|
417
|
+
const m = () => {
|
|
418
|
+
h.value.dialogVisible = !0, setTimeout(() => {
|
|
419
|
+
var l, f;
|
|
420
|
+
const n = (l = document == null ? void 0 : document.querySelector) == null ? void 0 : l.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
421
|
+
n && (n.innerHTML = ((f = s.value) == null ? void 0 : f.tipText) || "上传");
|
|
408
422
|
});
|
|
409
423
|
};
|
|
410
424
|
t.ui.registry.addMenuItem("localAudio", {
|
|
411
425
|
text: "音频",
|
|
412
426
|
icon: "arrow-right",
|
|
413
|
-
onAction: () =>
|
|
427
|
+
onAction: () => m()
|
|
414
428
|
}), t.ui.registry.addButton("localAudio", {
|
|
415
429
|
icon: "arrow-right",
|
|
416
430
|
tooltip: "音频",
|
|
417
|
-
onAction: () =>
|
|
431
|
+
onAction: () => m()
|
|
418
432
|
});
|
|
419
433
|
}
|
|
420
|
-
if ((
|
|
421
|
-
const
|
|
422
|
-
|
|
434
|
+
if ((u = c == null ? void 0 : c.value) != null && u.enable) {
|
|
435
|
+
const m = () => {
|
|
436
|
+
b.value.dialogVisible = !0;
|
|
423
437
|
};
|
|
424
438
|
t.ui.registry.addMenuItem("localVideo", {
|
|
425
439
|
text: "视频",
|
|
426
440
|
icon: "embed",
|
|
427
|
-
onAction: () =>
|
|
441
|
+
onAction: () => m()
|
|
428
442
|
}), t.ui.registry.addButton("localVideo", {
|
|
429
443
|
icon: "embed",
|
|
430
444
|
tooltip: "视频",
|
|
431
|
-
onAction: () =>
|
|
445
|
+
onAction: () => m()
|
|
432
446
|
});
|
|
433
447
|
}
|
|
434
448
|
}
|
|
435
|
-
}, a =
|
|
449
|
+
}, a = P(
|
|
436
450
|
[
|
|
437
|
-
|
|
438
|
-
|
|
451
|
+
d.options,
|
|
452
|
+
S.options,
|
|
439
453
|
e
|
|
440
454
|
],
|
|
441
455
|
{
|
|
442
|
-
mergeFunction: (t, i) => (...
|
|
443
|
-
t(...
|
|
456
|
+
mergeFunction: (t, i) => (...r) => {
|
|
457
|
+
t(...r), i(...r);
|
|
444
458
|
},
|
|
445
459
|
type: Object
|
|
446
460
|
}
|
|
447
461
|
);
|
|
448
|
-
|
|
462
|
+
Z.init(a).then(([t]) => {
|
|
449
463
|
var i;
|
|
450
|
-
t && (t.customProps = { ...
|
|
464
|
+
t && (t.customProps = { ...d }, t.on("input", () => {
|
|
451
465
|
if (k.value) {
|
|
452
466
|
k.value = !1;
|
|
453
467
|
return;
|
|
454
468
|
}
|
|
455
|
-
|
|
469
|
+
U.value = !0, M("input", t.getContent());
|
|
456
470
|
}), t.on("change", () => {
|
|
457
471
|
M("input", t.getContent());
|
|
458
|
-
}), t.on("paste", (
|
|
459
|
-
|
|
460
|
-
}), t.on("drop", (
|
|
461
|
-
|
|
462
|
-
}), (i =
|
|
472
|
+
}), t.on("paste", (r) => {
|
|
473
|
+
X(r);
|
|
474
|
+
}), t.on("drop", (r) => {
|
|
475
|
+
J(r);
|
|
476
|
+
}), (i = d.initComplete) == null || i.call(d, { editorIns: t }), g.value = t);
|
|
463
477
|
});
|
|
464
|
-
}),
|
|
478
|
+
}), Ae(() => {
|
|
465
479
|
var e, a, o, t;
|
|
466
|
-
(e =
|
|
480
|
+
(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
481
|
});
|
|
468
|
-
const
|
|
482
|
+
const ne = () => {
|
|
469
483
|
var a, o;
|
|
470
|
-
const e = { ...
|
|
471
|
-
return ((o = (a =
|
|
472
|
-
},
|
|
484
|
+
const e = { ...h.value.additionalData || {} };
|
|
485
|
+
return ((o = (a = x.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
486
|
+
}, se = () => {
|
|
473
487
|
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
|
|
488
|
+
const e = { ...h.value.additionalData || {} };
|
|
489
|
+
return ((o = (a = x.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
490
|
+
}, ue = (e, a, o) => {
|
|
491
|
+
var i, r;
|
|
492
|
+
const t = (r = (i = x == null ? void 0 : x.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : r.call(i, e);
|
|
493
|
+
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;
|
|
494
|
+
}, me = (e, a) => new Promise((o, t) => {
|
|
495
|
+
var r, u, m, n, l, f;
|
|
482
496
|
const i = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
483
|
-
if (!((
|
|
484
|
-
p.error(`请上传格式为${(
|
|
497
|
+
if (!((u = (r = x.value) == null ? void 0 : r.allowedType) != null && u.includes(i.toLowerCase()))) {
|
|
498
|
+
p.error(`请上传格式为${(n = (m = x.value) == null ? void 0 : m.allowedType) == null ? void 0 : n.map((D) => D.toUpperCase()).join("、")}的音频`), t();
|
|
485
499
|
return;
|
|
486
500
|
}
|
|
487
|
-
if (e.size > (((
|
|
488
|
-
p.error(`请上传${((
|
|
501
|
+
if (e.size > (((l = x.value) == null ? void 0 : l.maxSize) || 0) * 1024 * 1024) {
|
|
502
|
+
p.error(`请上传${((f = x.value) == null ? void 0 : f.maxSize) || 0}M内的音频`), t();
|
|
489
503
|
return;
|
|
490
504
|
}
|
|
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 })) || {};
|
|
505
|
+
h.value.additionalData = { file: e }, o(!0);
|
|
506
|
+
}), de = (e, a) => {
|
|
507
|
+
h.value.formData.file = a;
|
|
508
|
+
}, ce = (e, a, o) => {
|
|
509
|
+
p.error("上传发生错误,请重试!"), h.value.formData.file = o;
|
|
500
510
|
}, pe = () => {
|
|
501
511
|
var a, o;
|
|
502
|
-
const e = { ...
|
|
503
|
-
return ((o = (a =
|
|
504
|
-
}, fe = (
|
|
505
|
-
var
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
}, ve = (e, a
|
|
509
|
-
var
|
|
512
|
+
const e = { ...b.value.additionalData || {} };
|
|
513
|
+
return ((o = (a = c.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
514
|
+
}, fe = () => {
|
|
515
|
+
var a, o;
|
|
516
|
+
const e = { ...b.value.additionalData || {} };
|
|
517
|
+
return ((o = (a = c.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: d.extParameters })) || {};
|
|
518
|
+
}, ve = (e, a, o) => {
|
|
519
|
+
var i, r;
|
|
520
|
+
const t = (r = (i = c == null ? void 0 : c.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : r.call(i, e);
|
|
521
|
+
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;
|
|
522
|
+
}, ge = (e, a) => new Promise((o, t) => {
|
|
523
|
+
var r, u, m, n, l, f;
|
|
510
524
|
const i = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
511
|
-
if (!((
|
|
512
|
-
p.error(`请上传格式为${(
|
|
525
|
+
if (!((u = (r = c == null ? void 0 : c.value) == null ? void 0 : r.allowedType) != null && u.includes(i.toLowerCase()))) {
|
|
526
|
+
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
527
|
return;
|
|
514
528
|
}
|
|
515
|
-
if (e.size > (((
|
|
516
|
-
p.error(`请上传${((
|
|
529
|
+
if (e.size > (((l = c == null ? void 0 : c.value) == null ? void 0 : l.maxSize) || 0) * 1024 * 1024) {
|
|
530
|
+
p.error(`请上传${((f = c == null ? void 0 : c.value) == null ? void 0 : f.maxSize) || 0}M内的视频`), t();
|
|
517
531
|
return;
|
|
518
532
|
}
|
|
519
|
-
|
|
520
|
-
}),
|
|
521
|
-
|
|
522
|
-
},
|
|
523
|
-
p.error("上传发生错误,请重试!"),
|
|
533
|
+
b.value.additionalData = { file: e }, o(!0);
|
|
534
|
+
}), he = (e, a) => {
|
|
535
|
+
b.value.formData.file = a;
|
|
536
|
+
}, xe = (e, a, o) => {
|
|
537
|
+
p.error("上传发生错误,请重试!"), b.value.formData.file = o;
|
|
524
538
|
};
|
|
525
|
-
return
|
|
539
|
+
return V(() => [d.disabled, g.value], () => {
|
|
526
540
|
var e, a;
|
|
527
|
-
(a = (e =
|
|
528
|
-
}, { immediate: !0 }),
|
|
529
|
-
() => [
|
|
541
|
+
(a = (e = g.value) == null ? void 0 : e.mode) == null || a.set(d.disabled ? "readonly" : "design");
|
|
542
|
+
}, { immediate: !0 }), V(
|
|
543
|
+
() => [d.value, g.value],
|
|
530
544
|
() => {
|
|
531
545
|
var e;
|
|
532
|
-
if (
|
|
533
|
-
|
|
546
|
+
if (U.value) {
|
|
547
|
+
U.value = !1;
|
|
534
548
|
return;
|
|
535
549
|
}
|
|
536
|
-
k.value = !0, (e =
|
|
550
|
+
k.value = !0, (e = g.value) == null || e.setContent(d.value ? d.value : "");
|
|
537
551
|
},
|
|
538
552
|
{ immediate: !0 }
|
|
539
|
-
), { __sfc: !0, defaultImageUploadOptions:
|
|
553
|
+
), { __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
554
|
}
|
|
541
555
|
});
|
|
542
556
|
export {
|
|
543
|
-
|
|
557
|
+
ha as default
|
|
544
558
|
};
|
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.52",
|
|
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.17"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^2.7.0",
|