@keyblade/tinymce-editor-vue2 0.1.1 → 1.0.0
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/README.md +77 -3
- package/es/editor.vue.d.ts +1 -5
- package/es/editor.vue.js +20 -20
- package/es/editor.vue2.js +263 -329
- package/es/index.d.ts +26 -46
- package/es/types.d.ts +40 -18
- package/package.json +2 -3
- package/src/index.ts +0 -3
package/es/editor.vue2.js
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
1
|
+
var Be = Object.defineProperty, Ve = Object.defineProperties;
|
|
2
|
+
var je = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ue = Object.getOwnPropertySymbols;
|
|
4
|
+
var He = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ce = (u, n) => (n = Symbol[u]) ? n : Symbol.for("Symbol." + u);
|
|
6
|
+
var me = (u, n, i) => n in u ? Be(u, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : u[n] = i, D = (u, n) => {
|
|
7
7
|
for (var i in n || (n = {}))
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
for (var i of
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
var L = (
|
|
15
|
-
var
|
|
8
|
+
He.call(n, i) && me(u, i, n[i]);
|
|
9
|
+
if (ue)
|
|
10
|
+
for (var i of ue(n))
|
|
11
|
+
$e.call(n, i) && me(u, i, n[i]);
|
|
12
|
+
return u;
|
|
13
|
+
}, B = (u, n) => Ve(u, je(n));
|
|
14
|
+
var L = (u, n, i) => new Promise((O, T) => {
|
|
15
|
+
var P = (g) => {
|
|
16
16
|
try {
|
|
17
|
-
|
|
18
|
-
} catch (
|
|
19
|
-
I
|
|
17
|
+
c(i.next(g));
|
|
18
|
+
} catch (I) {
|
|
19
|
+
T(I);
|
|
20
20
|
}
|
|
21
|
-
},
|
|
21
|
+
}, V = (g) => {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
} catch (
|
|
25
|
-
I
|
|
23
|
+
c(i.throw(g));
|
|
24
|
+
} catch (I) {
|
|
25
|
+
T(I);
|
|
26
26
|
}
|
|
27
|
-
},
|
|
28
|
-
|
|
27
|
+
}, c = (g) => g.done ? O(g.value) : Promise.resolve(g.value).then(P, V);
|
|
28
|
+
c((i = i.apply(u, n)).next());
|
|
29
29
|
});
|
|
30
|
-
var
|
|
31
|
-
import { defineComponent as
|
|
32
|
-
import {
|
|
33
|
-
import { blobToFile as
|
|
30
|
+
var G = (u, n, i) => (n = u[ce("asyncIterator")]) ? n.call(u) : (u = u[ce("iterator")](), n = {}, i = (O, T) => (T = u[O]) && (n[O] = (P) => new Promise((V, c, g) => (P = T.call(u, P), g = P.done, Promise.resolve(P.value).then((I) => V({ value: I, done: g }), c)))), i("next"), i("return"), n);
|
|
31
|
+
import { defineComponent as Ee, ref as A, computed as X, onMounted as Re, onUnmounted as qe, watch as de } from "vue";
|
|
32
|
+
import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We } from "@keyblade/one-travel";
|
|
33
|
+
import { blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "./util.js";
|
|
34
34
|
import "./style.less.js";
|
|
35
|
-
import Oe from "imgpond";
|
|
36
35
|
import { conclude as F } from "vue-global-config";
|
|
37
36
|
import pe from "tinymce";
|
|
38
|
-
import
|
|
37
|
+
import Xe from "./langs/zh_CN.js";
|
|
39
38
|
import "tinymce/skins/ui/oxide/skin";
|
|
40
39
|
import "tinymce/models/dom";
|
|
41
40
|
import "tinymce/themes/silver";
|
|
@@ -66,9 +65,10 @@ import "tinymce/plugins/table";
|
|
|
66
65
|
import "tinymce/plugins/visualblocks";
|
|
67
66
|
import "tinymce/plugins/visualchars";
|
|
68
67
|
import "tinymce/plugins/wordcount";
|
|
69
|
-
import { globalProps as
|
|
70
|
-
import { Message as
|
|
71
|
-
|
|
68
|
+
import { globalProps as W } from "./index.js";
|
|
69
|
+
import { Message as b } from "element-ui";
|
|
70
|
+
import { defaultImageUploadOptions as S, EImageUploadInnerBeforeUploadStep as Je } from "@keyblade/pro-components-vue2";
|
|
71
|
+
const $a = /* @__PURE__ */ Ee({
|
|
72
72
|
__name: "editor",
|
|
73
73
|
props: {
|
|
74
74
|
value: { default: "" },
|
|
@@ -76,93 +76,55 @@ const Ha = /* @__PURE__ */ $e({
|
|
|
76
76
|
extParameters: { default: () => ({}) },
|
|
77
77
|
options: { default: () => ({}) },
|
|
78
78
|
imageUploadOptions: null,
|
|
79
|
-
imgPondOptions: null,
|
|
80
79
|
audioUploadOptions: null,
|
|
81
80
|
videoUploadOptions: null,
|
|
82
81
|
initComplete: null
|
|
83
82
|
},
|
|
84
83
|
emits: ["input"],
|
|
85
|
-
setup(
|
|
86
|
-
const i =
|
|
87
|
-
pe.addI18n("zh_CN",
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
84
|
+
setup(u, { emit: n }) {
|
|
85
|
+
const i = u;
|
|
86
|
+
pe.addI18n("zh_CN", Xe);
|
|
87
|
+
const O = {
|
|
88
|
+
name: S.name,
|
|
89
|
+
accept: S.accept,
|
|
90
|
+
multiple: S.multiple,
|
|
91
|
+
limit: S.limit,
|
|
92
|
+
disabled: S.disabled,
|
|
93
|
+
hideInnerBeforeUploadLoading: S.hideInnerBeforeUploadLoading,
|
|
94
|
+
checkOptions: S.checkOptions,
|
|
95
|
+
compressorOptions: S.compressorOptions,
|
|
96
|
+
cropOptions: S.cropOptions
|
|
97
|
+
}, T = {
|
|
98
98
|
enable: !0,
|
|
99
99
|
maxSize: 300,
|
|
100
100
|
allowedType: ["avi", "wmv", "mp4", "mov", "3gp"],
|
|
101
101
|
accept: ".avi,.wmv,.mp4,.mov,.3gp"
|
|
102
|
-
},
|
|
102
|
+
}, P = {
|
|
103
103
|
enable: !0,
|
|
104
104
|
maxSize: 200,
|
|
105
105
|
allowedType: ["wav", "mp3", "mp4", "m4a", "wma", "aac"],
|
|
106
106
|
accept: ".wav,.mp3,.mp4,.m4a,.wma,.aac"
|
|
107
|
-
},
|
|
107
|
+
}, V = A(), c = A(), g = A(!1), I = A(!1), $ = A({
|
|
108
108
|
show: !1,
|
|
109
109
|
text: "图片上传中,请稍等"
|
|
110
|
-
}),
|
|
111
|
-
var e, a;
|
|
112
|
-
return ((a = (e = s == null ? void 0 : s.value) == null ? void 0 : e.allowedType) == null ? void 0 : a.map((t) => `.${t}`).join(",")) || "";
|
|
113
|
-
}), W = y();
|
|
114
|
-
O(() => W.value, () => {
|
|
115
|
-
W.value && me(W.value, {
|
|
116
|
-
onStart: () => {
|
|
117
|
-
T.value = {
|
|
118
|
-
show: !0,
|
|
119
|
-
text: "图片加载中,请稍等"
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
onSuccess: () => {
|
|
123
|
-
T.value.show = !1;
|
|
124
|
-
},
|
|
125
|
-
onError: (e) => {
|
|
126
|
-
T.value.show = !1, g.error({ message: e, customClass: "tinymce-editor-message", duration: 3e3 });
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}, { immediate: !0 });
|
|
130
|
-
const N = y();
|
|
131
|
-
O(() => N.value, () => {
|
|
132
|
-
N.value && me(N.value, {
|
|
133
|
-
onStart: () => {
|
|
134
|
-
T.value = {
|
|
135
|
-
show: !0,
|
|
136
|
-
text: "图片加载中,请稍等"
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
onSuccess: () => {
|
|
140
|
-
T.value.show = !1;
|
|
141
|
-
},
|
|
142
|
-
onError: (e) => {
|
|
143
|
-
T.value.show = !1, g.error(e);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}, { immediate: !0 });
|
|
147
|
-
const E = y({
|
|
110
|
+
}), p = X(() => F([i.imageUploadOptions, W.imageUploadOptions, O]) || {}), s = X(() => F([i.videoUploadOptions, W.videoUploadOptions, T]) || {}), v = X(() => F([i.audioUploadOptions, W.audioUploadOptions, P]) || {}), E = A({
|
|
148
111
|
dialogVisible: !1,
|
|
149
112
|
formData: {
|
|
150
113
|
images: []
|
|
151
114
|
}
|
|
152
|
-
}),
|
|
153
|
-
|
|
115
|
+
}), j = A(), J = A(), K = () => {
|
|
116
|
+
E.value.dialogVisible = !1, E.value.formData = {
|
|
154
117
|
images: []
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}), Y());
|
|
118
|
+
}, j.value = void 0;
|
|
119
|
+
}, fe = () => {
|
|
120
|
+
var o;
|
|
121
|
+
(o = J.value) == null || o.validate((e) => {
|
|
122
|
+
e && (E.value.formData.images.forEach((a) => {
|
|
123
|
+
var t;
|
|
124
|
+
(t = c.value) == null || t.insertContent(`<img src=${a == null ? void 0 : a.url} alt="" />`);
|
|
125
|
+
}), K());
|
|
164
126
|
});
|
|
165
|
-
},
|
|
127
|
+
}, w = A({
|
|
166
128
|
dialogVisible: !1,
|
|
167
129
|
formData: {
|
|
168
130
|
// 名称
|
|
@@ -174,19 +136,19 @@ const Ha = /* @__PURE__ */ $e({
|
|
|
174
136
|
},
|
|
175
137
|
// 用于临时保存上传前的参数 { file: File }
|
|
176
138
|
additionalData: {}
|
|
177
|
-
}),
|
|
178
|
-
|
|
139
|
+
}), Q = A(), Y = () => {
|
|
140
|
+
w.value.dialogVisible = !1, w.value.formData = {
|
|
179
141
|
name: "",
|
|
180
142
|
cover: [],
|
|
181
143
|
file: []
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
var
|
|
185
|
-
(
|
|
186
|
-
var
|
|
187
|
-
|
|
144
|
+
}, w.value.additionalData = {}, j.value = void 0;
|
|
145
|
+
}, ve = () => {
|
|
146
|
+
var o;
|
|
147
|
+
(o = Q.value) == null || o.validate((e) => {
|
|
148
|
+
var a, t;
|
|
149
|
+
e && ((t = c.value) == null || t.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${w.value.formData.name}" data-poster="${w.value.formData.cover[0]}" src="${(a = w.value.formData.file[0]) == null ? void 0 : a.url}"></audio>`), Y());
|
|
188
150
|
});
|
|
189
|
-
}, _ =
|
|
151
|
+
}, _ = A({
|
|
190
152
|
dialogVisible: !1,
|
|
191
153
|
formData: {
|
|
192
154
|
// 文件
|
|
@@ -194,183 +156,153 @@ const Ha = /* @__PURE__ */ $e({
|
|
|
194
156
|
},
|
|
195
157
|
// 用于临时保存上传前的参数 { file: File }
|
|
196
158
|
additionalData: {}
|
|
197
|
-
}),
|
|
159
|
+
}), Z = A(), ee = () => {
|
|
198
160
|
_.value.dialogVisible = !1, _.value.formData = {
|
|
199
161
|
file: []
|
|
200
162
|
}, _.value.additionalData = {};
|
|
201
|
-
},
|
|
202
|
-
var
|
|
203
|
-
(
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
});
|
|
207
|
-
}, xe = () => {
|
|
208
|
-
document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
|
|
209
|
-
e && (e.innerHTML = `单次最多可选择${s.value.maxCount}张图片`);
|
|
163
|
+
}, ge = () => {
|
|
164
|
+
var o;
|
|
165
|
+
(o = Z.value) == null || o.validate((e) => {
|
|
166
|
+
var a, t;
|
|
167
|
+
e && ((t = c.value) == null || t.insertContent(`<video width="auto" height="auto" controls src="${(a = _.value.formData.file[0]) == null ? void 0 : a.url}"></video>`), ee());
|
|
210
168
|
});
|
|
211
169
|
};
|
|
212
|
-
|
|
213
|
-
const we = (e, a) => new Promise((t, o) => L(this, null, function* () {
|
|
214
|
-
var f, v;
|
|
215
|
-
if (H.find((p) => (p == null ? void 0 : p.uid) === (e == null ? void 0 : e.uid)))
|
|
216
|
-
return setTimeout(() => {
|
|
217
|
-
document.querySelectorAll(".swal2-container").forEach((p) => {
|
|
218
|
-
p == null || p.remove();
|
|
219
|
-
});
|
|
220
|
-
}), o("");
|
|
221
|
-
H.push(e);
|
|
222
|
-
const l = yield de(e);
|
|
223
|
-
if (!l.success) {
|
|
224
|
-
o(), setTimeout(() => {
|
|
225
|
-
a.onError(l.errorMessage);
|
|
226
|
-
});
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
const c = yield (v = (f = s.value).handleRequest) == null ? void 0 : v.call(f, ce(l.file, e.name), e.name, { extParameters: i.extParameters });
|
|
230
|
-
if (!c || !(c != null && c.success)) {
|
|
231
|
-
o(), setTimeout(() => {
|
|
232
|
-
a.onError(c == null ? void 0 : c.errorMessage);
|
|
233
|
-
});
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
t(c.url);
|
|
237
|
-
}));
|
|
238
|
-
function oe(e) {
|
|
170
|
+
function ae(o) {
|
|
239
171
|
return L(this, null, function* () {
|
|
240
|
-
var
|
|
241
|
-
let
|
|
242
|
-
if (!((
|
|
243
|
-
|
|
172
|
+
var m, d, y, f, C, h, U, M, R;
|
|
173
|
+
let e = o;
|
|
174
|
+
if (!((m = p.value) != null && m.handleRequest)) {
|
|
175
|
+
b.error("缺少图片上传配置");
|
|
244
176
|
return;
|
|
245
177
|
}
|
|
246
|
-
let
|
|
247
|
-
if (!(
|
|
248
|
-
|
|
178
|
+
let a = e.name ? e.name : "";
|
|
179
|
+
if (!(e != null && e.name) && !(e != null && e.lastModified) && e.type === "image/png") {
|
|
180
|
+
b.error("不允许粘贴");
|
|
249
181
|
return;
|
|
250
182
|
}
|
|
251
|
-
const
|
|
252
|
-
imageMaxSize:
|
|
253
|
-
imageAllowedType:
|
|
183
|
+
const t = yield Fe(e, a, {
|
|
184
|
+
imageMaxSize: (d = p.value.checkOptions) == null ? void 0 : d.maxSize,
|
|
185
|
+
imageAllowedType: (y = p.value.checkOptions) == null ? void 0 : y.allowedType,
|
|
254
186
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
255
|
-
imageMinWidth:
|
|
256
|
-
imageMinHeight:
|
|
257
|
-
imageMaxWidth:
|
|
258
|
-
imageMaxHeight:
|
|
187
|
+
imageMinWidth: (f = p.value.checkOptions) == null ? void 0 : f.minWidth,
|
|
188
|
+
imageMinHeight: (C = p.value.checkOptions) == null ? void 0 : C.minHeight,
|
|
189
|
+
imageMaxWidth: (h = p.value.checkOptions) == null ? void 0 : h.maxWidth,
|
|
190
|
+
imageMaxHeight: (U = p.value.checkOptions) == null ? void 0 : U.maxHeight
|
|
259
191
|
});
|
|
260
|
-
if (!
|
|
261
|
-
|
|
192
|
+
if (!t.success) {
|
|
193
|
+
b.error((t == null ? void 0 : t.errorMessage) || "");
|
|
262
194
|
return;
|
|
263
195
|
}
|
|
264
|
-
if (
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
196
|
+
if (t.hasTransform) {
|
|
197
|
+
e = t.file;
|
|
198
|
+
const ie = a == null ? void 0 : a.split(".");
|
|
199
|
+
ie.pop(), a = `${ie.join(",")}.jpg`;
|
|
268
200
|
}
|
|
269
|
-
const r = yield
|
|
201
|
+
const r = yield We(e);
|
|
270
202
|
if (!r.success) {
|
|
271
|
-
|
|
203
|
+
b.error((r == null ? void 0 : r.errorMessage) || "压缩失败");
|
|
272
204
|
return;
|
|
273
205
|
}
|
|
274
|
-
const l = yield (
|
|
206
|
+
const l = yield (R = (M = p.value).handleRequest) == null ? void 0 : R.call(M, Ne(r.file, a), a, { extParameters: i.extParameters });
|
|
275
207
|
if (!l || !l.success) {
|
|
276
|
-
|
|
208
|
+
b.error((l == null ? void 0 : l.errorMessage) || "");
|
|
277
209
|
return;
|
|
278
210
|
}
|
|
279
211
|
return l.url;
|
|
280
212
|
});
|
|
281
213
|
}
|
|
282
|
-
const
|
|
283
|
-
var l,
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
|
|
214
|
+
const N = (o) => L(this, null, function* () {
|
|
215
|
+
var l, m, d, y, f, C, h, U, M, R, le, ne, re;
|
|
216
|
+
const e = c.value, a = o.types;
|
|
217
|
+
if (a.includes("text/html")) {
|
|
218
|
+
const z = o.getData("text/html"), H = new DOMParser().parseFromString(z, "text/html"), se = Array.from(H.body.querySelectorAll("img")), Te = Array.from(H.body.querySelectorAll("audio")), ze = Array.from(H.body.querySelectorAll("video"));
|
|
219
|
+
se.length > 0 && ($.value = {
|
|
288
220
|
show: !0,
|
|
289
221
|
text: "图片加载中,请稍等"
|
|
290
222
|
});
|
|
291
|
-
for (const
|
|
292
|
-
|
|
223
|
+
for (const k of [...Te, ...ze])
|
|
224
|
+
k == null || k.remove();
|
|
293
225
|
try {
|
|
294
|
-
for (var
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
if ((l =
|
|
298
|
-
const
|
|
299
|
-
|
|
226
|
+
for (var ie = G([...se]), Ke, qa, Fa; Ke = !(qa = yield ie.next()).done; Ke = !1) {
|
|
227
|
+
const k = qa.value;
|
|
228
|
+
if (k.removeAttribute("crossorigin"), k.src.startsWith("http"))
|
|
229
|
+
if ((l = p.value) != null && l.handleRequestByUrl) {
|
|
230
|
+
const x = yield (m = p.value) == null ? void 0 : m.handleRequestByUrl(k.src, { extParameters: i.extParameters });
|
|
231
|
+
x != null && x.success && (x != null && x.url) ? k.src = x == null ? void 0 : x.url : k.remove();
|
|
300
232
|
} else {
|
|
301
|
-
const
|
|
302
|
-
|
|
233
|
+
const x = yield Le(k.src);
|
|
234
|
+
x && (x.width < (((y = (d = p.value) == null ? void 0 : d.checkOptions) == null ? void 0 : y.minWidth) || 0) && x.height < (((C = (f = p.value) == null ? void 0 : f.checkOptions) == null ? void 0 : C.minHeight) || 0) || x.width > (((U = (h = p.value) == null ? void 0 : h.checkOptions) == null ? void 0 : U.maxWidth) || 0) && x.height > (((R = (M = p.value) == null ? void 0 : M.checkOptions) == null ? void 0 : R.maxHeight) || 0)) && k.remove();
|
|
303
235
|
}
|
|
304
236
|
else
|
|
305
|
-
|
|
237
|
+
k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
306
238
|
}
|
|
307
|
-
} catch (
|
|
308
|
-
|
|
239
|
+
} catch (qa) {
|
|
240
|
+
Fa = [qa];
|
|
309
241
|
} finally {
|
|
310
242
|
try {
|
|
311
|
-
|
|
243
|
+
Ke && (qa = ie.return) && (yield qa.call(ie));
|
|
312
244
|
} finally {
|
|
313
|
-
if (
|
|
314
|
-
throw
|
|
245
|
+
if (Fa)
|
|
246
|
+
throw Fa[0];
|
|
315
247
|
}
|
|
316
248
|
}
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
|
|
249
|
+
$.value.show = !1;
|
|
250
|
+
const Oe = new XMLSerializer().serializeToString(H.body);
|
|
251
|
+
e.insertContent(Oe);
|
|
320
252
|
} else
|
|
321
|
-
|
|
322
|
-
const
|
|
323
|
-
for (const
|
|
324
|
-
if (!
|
|
253
|
+
a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
|
|
254
|
+
const t = Array.from((o == null ? void 0 : o.files) || []), r = [];
|
|
255
|
+
for (const z of t) {
|
|
256
|
+
if (!z)
|
|
325
257
|
continue;
|
|
326
|
-
const
|
|
327
|
-
|
|
258
|
+
const q = Ge(z.name);
|
|
259
|
+
z.type.indexOf("image") > -1 || (re = (ne = (le = p.value) == null ? void 0 : le.checkOptions) == null ? void 0 : ne.allowedType) != null && re.includes(q.toLowerCase()) ? r.push(z) : b.error("暂不支持的文件类型");
|
|
328
260
|
}
|
|
329
261
|
if (r.length > 0) {
|
|
330
|
-
|
|
262
|
+
$.value = {
|
|
331
263
|
show: !0,
|
|
332
264
|
text: "图片上传中,请稍等"
|
|
333
265
|
};
|
|
334
266
|
try {
|
|
335
|
-
for (var
|
|
336
|
-
const
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
const
|
|
340
|
-
|
|
267
|
+
for (var Wa = G(r), Na, La, Ga; Na = !(La = yield Wa.next()).done; Na = !1) {
|
|
268
|
+
const z = La.value;
|
|
269
|
+
const q = yield ae(z);
|
|
270
|
+
if (q) {
|
|
271
|
+
const H = `<img src="${q}" alt="" />`;
|
|
272
|
+
e.insertContent(H);
|
|
341
273
|
}
|
|
342
274
|
}
|
|
343
|
-
} catch (
|
|
344
|
-
|
|
275
|
+
} catch (La) {
|
|
276
|
+
Ga = [La];
|
|
345
277
|
} finally {
|
|
346
278
|
try {
|
|
347
|
-
|
|
279
|
+
Na && (La = Wa.return) && (yield La.call(Wa));
|
|
348
280
|
} finally {
|
|
349
|
-
if (
|
|
350
|
-
throw
|
|
281
|
+
if (Ga)
|
|
282
|
+
throw Ga[0];
|
|
351
283
|
}
|
|
352
284
|
}
|
|
353
|
-
|
|
285
|
+
$.value.show = !1;
|
|
354
286
|
}
|
|
355
|
-
n("input",
|
|
356
|
-
}),
|
|
357
|
-
var
|
|
358
|
-
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
},
|
|
362
|
-
var
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
287
|
+
n("input", e.getContent());
|
|
288
|
+
}), oe = (o) => {
|
|
289
|
+
var a;
|
|
290
|
+
o.preventDefault();
|
|
291
|
+
const e = o.clipboardData || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.clipboardData);
|
|
292
|
+
N(e);
|
|
293
|
+
}, te = (o) => {
|
|
294
|
+
var a;
|
|
295
|
+
o.preventDefault();
|
|
296
|
+
const e = o.dataTransfer || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.dataTransfer);
|
|
297
|
+
N(e);
|
|
366
298
|
};
|
|
367
|
-
|
|
368
|
-
var t;
|
|
369
|
-
const
|
|
299
|
+
Re(() => {
|
|
300
|
+
var a, t, r;
|
|
301
|
+
const o = {
|
|
370
302
|
// 设置语言
|
|
371
303
|
language: "zh_CN",
|
|
372
304
|
// 实例
|
|
373
|
-
target:
|
|
305
|
+
target: V.value,
|
|
374
306
|
// 隐藏品牌
|
|
375
307
|
branding: !1,
|
|
376
308
|
// 隐藏右上角升级按钮
|
|
@@ -448,168 +380,170 @@ const Ha = /* @__PURE__ */ $e({
|
|
|
448
380
|
convert_urls: !1,
|
|
449
381
|
paste_webkit_styles: "all",
|
|
450
382
|
paste_data_images: !1,
|
|
451
|
-
images_file_types: ((t =
|
|
383
|
+
images_file_types: ((r = (t = (a = p.value) == null ? void 0 : a.checkOptions) == null ? void 0 : t.allowedType) == null ? void 0 : r.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
452
384
|
// 粘贴前处理
|
|
453
|
-
paste_preprocess(
|
|
454
|
-
|
|
385
|
+
paste_preprocess(l, m) {
|
|
386
|
+
m == null || m.preventDefault();
|
|
455
387
|
},
|
|
456
|
-
setup(
|
|
457
|
-
var
|
|
458
|
-
const
|
|
459
|
-
E.value.dialogVisible = !0
|
|
460
|
-
var v, p;
|
|
461
|
-
const f = (v = document == null ? void 0 : document.querySelector) == null ? void 0 : v.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
462
|
-
f && (f.innerHTML = ((p = s.value) == null ? void 0 : p.tipText) || "上传");
|
|
463
|
-
});
|
|
388
|
+
setup(l) {
|
|
389
|
+
var d, y;
|
|
390
|
+
const m = () => {
|
|
391
|
+
E.value.dialogVisible = !0;
|
|
464
392
|
};
|
|
465
|
-
if (
|
|
393
|
+
if (l.ui.registry.addMenuItem("localImage", {
|
|
466
394
|
text: "图片",
|
|
467
395
|
icon: "image",
|
|
468
|
-
onAction: () =>
|
|
469
|
-
}),
|
|
396
|
+
onAction: () => m()
|
|
397
|
+
}), l.ui.registry.addButton("localImage", {
|
|
470
398
|
icon: "image",
|
|
471
399
|
tooltip: "图片",
|
|
472
|
-
onAction: () =>
|
|
473
|
-
}), (
|
|
400
|
+
onAction: () => m()
|
|
401
|
+
}), (d = v == null ? void 0 : v.value) != null && d.enable) {
|
|
474
402
|
const f = () => {
|
|
475
|
-
|
|
476
|
-
var p, M;
|
|
477
|
-
const v = (p = document == null ? void 0 : document.querySelector) == null ? void 0 : p.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
478
|
-
v && (v.innerHTML = ((M = s.value) == null ? void 0 : M.tipText) || "上传");
|
|
479
|
-
});
|
|
403
|
+
w.value.dialogVisible = !0;
|
|
480
404
|
};
|
|
481
|
-
|
|
405
|
+
l.ui.registry.addMenuItem("localAudio", {
|
|
482
406
|
text: "音频",
|
|
483
407
|
icon: "arrow-right",
|
|
484
408
|
onAction: () => f()
|
|
485
|
-
}),
|
|
409
|
+
}), l.ui.registry.addButton("localAudio", {
|
|
486
410
|
icon: "arrow-right",
|
|
487
411
|
tooltip: "音频",
|
|
488
412
|
onAction: () => f()
|
|
489
413
|
});
|
|
490
414
|
}
|
|
491
|
-
if ((
|
|
415
|
+
if ((y = s == null ? void 0 : s.value) != null && y.enable) {
|
|
492
416
|
const f = () => {
|
|
493
417
|
_.value.dialogVisible = !0;
|
|
494
418
|
};
|
|
495
|
-
|
|
419
|
+
l.ui.registry.addMenuItem("localVideo", {
|
|
496
420
|
text: "视频",
|
|
497
421
|
icon: "embed",
|
|
498
422
|
onAction: () => f()
|
|
499
|
-
}),
|
|
423
|
+
}), l.ui.registry.addButton("localVideo", {
|
|
500
424
|
icon: "embed",
|
|
501
425
|
tooltip: "视频",
|
|
502
426
|
onAction: () => f()
|
|
503
427
|
});
|
|
504
428
|
}
|
|
505
429
|
}
|
|
506
|
-
},
|
|
430
|
+
}, e = F(
|
|
507
431
|
[
|
|
508
432
|
i.options,
|
|
509
|
-
|
|
510
|
-
|
|
433
|
+
W.options,
|
|
434
|
+
o
|
|
511
435
|
],
|
|
512
436
|
{
|
|
513
|
-
mergeFunction: (
|
|
514
|
-
|
|
437
|
+
mergeFunction: (l, m) => (...d) => {
|
|
438
|
+
l(...d), m(...d);
|
|
515
439
|
},
|
|
516
440
|
type: Object
|
|
517
441
|
}
|
|
518
442
|
);
|
|
519
|
-
pe.init(
|
|
520
|
-
var
|
|
521
|
-
|
|
522
|
-
if (
|
|
523
|
-
|
|
443
|
+
pe.init(e).then(([l]) => {
|
|
444
|
+
var m;
|
|
445
|
+
l && (l.customProps = D({}, i), l.on("input", () => {
|
|
446
|
+
if (I.value) {
|
|
447
|
+
I.value = !1;
|
|
524
448
|
return;
|
|
525
449
|
}
|
|
526
|
-
|
|
527
|
-
}),
|
|
528
|
-
n("input",
|
|
529
|
-
}),
|
|
530
|
-
|
|
531
|
-
}),
|
|
532
|
-
|
|
533
|
-
}), (
|
|
450
|
+
g.value = !0, n("input", l.getContent());
|
|
451
|
+
}), l.on("change", () => {
|
|
452
|
+
n("input", l.getContent());
|
|
453
|
+
}), l.on("paste", (d) => {
|
|
454
|
+
oe(d);
|
|
455
|
+
}), l.on("drop", (d) => {
|
|
456
|
+
te(d);
|
|
457
|
+
}), (m = i.initComplete) == null || m.call(i, { editorIns: l }), c.value = l);
|
|
534
458
|
});
|
|
535
|
-
}),
|
|
536
|
-
var e, a, t
|
|
537
|
-
(
|
|
459
|
+
}), qe(() => {
|
|
460
|
+
var o, e, a, t;
|
|
461
|
+
(o = c.value) == null || o.off("input"), (e = c.value) == null || e.off("paste"), (a = c.value) == null || a.off("drop"), (t = c.value) == null || t.destroy();
|
|
538
462
|
});
|
|
539
|
-
const
|
|
540
|
-
var
|
|
541
|
-
const
|
|
542
|
-
return ((
|
|
463
|
+
const he = () => {
|
|
464
|
+
var e, a;
|
|
465
|
+
const o = D({}, j.value || {});
|
|
466
|
+
return ((a = (e = p.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
467
|
+
}, xe = () => {
|
|
468
|
+
var e, a;
|
|
469
|
+
const o = D({}, j.value || {});
|
|
470
|
+
return ((a = (e = p.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
471
|
+
}, be = (o, e, a) => {
|
|
472
|
+
a === Je.all && (j.value = { file: o });
|
|
473
|
+
}, we = () => {
|
|
474
|
+
var e, a;
|
|
475
|
+
const o = D({}, w.value.additionalData || {});
|
|
476
|
+
return ((a = (e = v.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
543
477
|
}, ye = () => {
|
|
544
|
-
var
|
|
545
|
-
const
|
|
546
|
-
return ((
|
|
547
|
-
},
|
|
478
|
+
var e, a;
|
|
479
|
+
const o = D({}, w.value.additionalData || {});
|
|
480
|
+
return ((a = (e = v.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
481
|
+
}, De = (o, e, a) => {
|
|
548
482
|
var r, l;
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
},
|
|
552
|
-
var l,
|
|
553
|
-
const r =
|
|
554
|
-
if (!((
|
|
555
|
-
|
|
483
|
+
const t = (l = (r = v == null ? void 0 : v.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, o);
|
|
484
|
+
t != null && t.url ? a[a.length - 1].url = t.url : t != null && t.errorMessage && (b.error(t.errorMessage), a.splice(a.length - 1, 1)), w.value.formData.file = a;
|
|
485
|
+
}, _e = (o, e) => new Promise((a, t) => {
|
|
486
|
+
var l, m, d, y, f, C, h, U;
|
|
487
|
+
const r = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
488
|
+
if (!((m = (l = v.value) == null ? void 0 : l.allowedType) != null && m.includes(r.toLowerCase()))) {
|
|
489
|
+
b.error(`请上传格式为${(y = (d = v.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的音频`), t();
|
|
556
490
|
return;
|
|
557
491
|
}
|
|
558
|
-
if (
|
|
559
|
-
|
|
492
|
+
if (o.size > (((f = v.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
|
|
493
|
+
b.error(`请上传${((C = v.value) == null ? void 0 : C.maxSize) || 0}M内的音频`), t();
|
|
560
494
|
return;
|
|
561
495
|
}
|
|
562
|
-
|
|
563
|
-
}),
|
|
564
|
-
|
|
565
|
-
},
|
|
566
|
-
|
|
496
|
+
w.value.additionalData = { file: o }, (U = (h = v == null ? void 0 : v.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
|
|
497
|
+
}), ke = (o, e) => {
|
|
498
|
+
w.value.formData.file = e;
|
|
499
|
+
}, Ae = (o, e, a) => {
|
|
500
|
+
b.error("上传发生错误,请重试!"), w.value.formData.file = a;
|
|
567
501
|
}, Ce = () => {
|
|
568
|
-
var
|
|
569
|
-
const
|
|
570
|
-
return ((
|
|
571
|
-
},
|
|
572
|
-
var
|
|
573
|
-
const
|
|
574
|
-
return ((
|
|
575
|
-
},
|
|
502
|
+
var e, a;
|
|
503
|
+
const o = D({}, _.value.additionalData || {});
|
|
504
|
+
return ((a = (e = s.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
505
|
+
}, Ue = () => {
|
|
506
|
+
var e, a;
|
|
507
|
+
const o = D({}, _.value.additionalData || {});
|
|
508
|
+
return ((a = (e = s.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
|
|
509
|
+
}, Ie = (o, e, a) => {
|
|
576
510
|
var r, l;
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
},
|
|
580
|
-
var l,
|
|
581
|
-
const r =
|
|
582
|
-
if (!((
|
|
583
|
-
|
|
511
|
+
const t = (l = (r = s == null ? void 0 : s.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, o);
|
|
512
|
+
t != null && t.url ? a[a.length - 1].url = t.url : t != null && t.errorMessage && (b.error(t.errorMessage), a.splice(a.length - 1, 1)), _.value.formData.file = a;
|
|
513
|
+
}, Pe = (o, e) => new Promise((a, t) => {
|
|
514
|
+
var l, m, d, y, f, C, h, U;
|
|
515
|
+
const r = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
|
|
516
|
+
if (!((m = (l = s == null ? void 0 : s.value) == null ? void 0 : l.allowedType) != null && m.includes(r.toLowerCase()))) {
|
|
517
|
+
b.error(`请上传格式为${(y = (d = s == null ? void 0 : s.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的视频`), t();
|
|
584
518
|
return;
|
|
585
519
|
}
|
|
586
|
-
if (
|
|
587
|
-
|
|
520
|
+
if (o.size > (((f = s == null ? void 0 : s.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
|
|
521
|
+
b.error(`请上传${((C = s == null ? void 0 : s.value) == null ? void 0 : C.maxSize) || 0}M内的视频`), t();
|
|
588
522
|
return;
|
|
589
523
|
}
|
|
590
|
-
_.value.additionalData = { file:
|
|
591
|
-
}),
|
|
592
|
-
_.value.formData.file =
|
|
593
|
-
},
|
|
594
|
-
|
|
524
|
+
_.value.additionalData = { file: o }, (U = (h = s == null ? void 0 : s.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
|
|
525
|
+
}), Me = (o, e) => {
|
|
526
|
+
_.value.formData.file = e;
|
|
527
|
+
}, Se = (o, e, a) => {
|
|
528
|
+
b.error("上传发生错误,请重试!"), _.value.formData.file = a;
|
|
595
529
|
};
|
|
596
|
-
return
|
|
597
|
-
var
|
|
598
|
-
(
|
|
599
|
-
}, { immediate: !0 }),
|
|
600
|
-
() => [i.value,
|
|
530
|
+
return de(() => [i.disabled, c.value], () => {
|
|
531
|
+
var o, e;
|
|
532
|
+
(e = (o = c.value) == null ? void 0 : o.mode) == null || e.set(i.disabled ? "readonly" : "design");
|
|
533
|
+
}, { immediate: !0 }), de(
|
|
534
|
+
() => [i.value, c.value],
|
|
601
535
|
() => {
|
|
602
|
-
var e, a, t
|
|
603
|
-
if (
|
|
604
|
-
|
|
536
|
+
var o, e, a, t;
|
|
537
|
+
if (g.value) {
|
|
538
|
+
g.value = !1;
|
|
605
539
|
return;
|
|
606
540
|
}
|
|
607
|
-
|
|
541
|
+
I.value = !0, (o = c.value) == null || o.setContent(i.value ? i.value : ""), (a = c.value) == null || a.selection.select((e = c.value) == null ? void 0 : e.getBody(), !0), (t = c.value) == null || t.selection.collapse(!1);
|
|
608
542
|
},
|
|
609
543
|
{ immediate: !0 }
|
|
610
|
-
), { __sfc: !0, defaultImageUploadOptions:
|
|
544
|
+
), { __sfc: !0, defaultImageUploadOptions: O, defaultVideoUploadOptions: T, defaultAudioUploadOptions: P, props: i, emits: n, insRef: V, editorRef: c, preventSettingContent: g, preventUpdatingModelValue: I, uploadLoadingConfig: $, mergeImageUploadOptions: p, mergeVideoUploadOptions: s, mergeAudioUploadOptions: v, uploadImage: E, uploadImageAdditionalData: j, uploadImageFormRef: J, onUploadImageClose: K, onUploadImageConfirm: fe, uploadAudio: w, uploadAudioFormRef: Q, onUploadAudioClose: Y, onUploadAudioConfirm: ve, uploadVideo: _, uploadVideoFormRef: Z, onUploadVideoClose: ee, onUploadVideoConfirm: ge, uploadPasteOrDropFile: ae, handleDataTransfer: N, onValuePaste: oe, onValueDrop: te, getUploadImageData: he, getUploadImageHeaders: xe, onUploadImageInnerBeforeUploadEnd: be, getUploadAudioData: we, getUploadAudioHeaders: ye, onUploadAudioSuccess: De, onUploadAudioBeforeUpload: _e, onUploadAudioRemove: ke, onUploadAudioError: Ae, getUploadVideoData: Ce, getUploadVideoHeaders: Ue, onUploadVideoSuccess: Ie, onUploadVideoBeforeUpload: Pe, onUploadVideoRemove: Me, onUploadVideoError: Se };
|
|
611
545
|
}
|
|
612
546
|
});
|
|
613
547
|
export {
|
|
614
|
-
|
|
548
|
+
$a as default
|
|
615
549
|
};
|