@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/es/editor.vue2.js CHANGED
@@ -1,41 +1,40 @@
1
- var Ee = Object.defineProperty, He = Object.defineProperties;
2
- var qe = Object.getOwnPropertyDescriptors;
3
- var ne = Object.getOwnPropertySymbols;
4
- var Ve = Object.prototype.hasOwnProperty, je = Object.prototype.propertyIsEnumerable;
5
- var se = (m, n) => (n = Symbol[m]) ? n : Symbol.for("Symbol." + m);
6
- var ue = (m, n, i) => n in m ? Ee(m, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : m[n] = i, P = (m, n) => {
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
- Ve.call(n, i) && ue(m, i, n[i]);
9
- if (ne)
10
- for (var i of ne(n))
11
- je.call(n, i) && ue(m, i, n[i]);
12
- return m;
13
- }, j = (m, n) => He(m, qe(n));
14
- var L = (m, n, i) => new Promise((k, I) => {
15
- var S = (x) => {
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
- d(i.next(x));
18
- } catch (C) {
19
- I(C);
17
+ c(i.next(g));
18
+ } catch (I) {
19
+ T(I);
20
20
  }
21
- }, z = (x) => {
21
+ }, V = (g) => {
22
22
  try {
23
- d(i.throw(x));
24
- } catch (C) {
25
- I(C);
23
+ c(i.throw(g));
24
+ } catch (I) {
25
+ T(I);
26
26
  }
27
- }, d = (x) => x.done ? k(x.value) : Promise.resolve(x.value).then(S, z);
28
- d((i = i.apply(m, n)).next());
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 K = (m, n, i) => (n = m[se("asyncIterator")]) ? n.call(m) : (m = m[se("iterator")](), n = {}, i = (k, I) => (I = m[k]) && (n[k] = (S) => new Promise((z, d, x) => (S = I.call(m, S), x = S.done, Promise.resolve(S.value).then((C) => z({ value: C, done: x }), d)))), i("next"), i("return"), n);
31
- import { defineComponent as $e, ref as y, computed as $, watch as O, onMounted as Fe, onUnmounted as Re } from "vue";
32
- import { oneTravelImgPondBeforeAddFile as me, oneTravelImageCompressor as de, oneTravelImageCheckAndTransform as We } from "@keyblade/one-travel";
33
- import { blobToFile as ce, getImagePixel as Ne, getFileExtension as Le } from "./util.js";
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 Ge from "./langs/zh_CN.js";
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 R } from "./index.js";
70
- import { Message as g } from "element-ui";
71
- const Ha = /* @__PURE__ */ $e({
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(m, { emit: n }) {
86
- const i = m;
87
- pe.addI18n("zh_CN", Ge);
88
- const k = {
89
- maxCount: 10,
90
- tipText: "上传",
91
- maxSize: 30,
92
- allowedType: ["jpg", "jpeg", "png", "bmp", "heif", "heic", "gif", "webp"],
93
- minWidth: 50,
94
- minHeight: 50,
95
- maxWidth: 6e3,
96
- maxHeight: 6e3
97
- }, I = {
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
- }, S = {
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
- }, z = y(), d = y(), x = y(!1), C = y(!1), T = y({
107
+ }, V = A(), c = A(), g = A(!1), I = A(!1), $ = A({
108
108
  show: !1,
109
109
  text: "图片上传中,请稍等"
110
- }), s = $(() => F([i.imageUploadOptions, R.imageUploadOptions, k]) || {}), u = $(() => F([i.videoUploadOptions, R.videoUploadOptions, I]) || {}), h = $(() => F([i.audioUploadOptions, R.audioUploadOptions, S]) || {}), G = $(() => F([i.imgPondOptions, R.imgPondOptions]) || {}), fe = $(() => {
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
- }), Q = y(), Y = () => {
153
- H = [], E.value.dialogVisible = !1, E.value.formData = {
115
+ }), j = A(), J = A(), K = () => {
116
+ E.value.dialogVisible = !1, E.value.formData = {
154
117
  images: []
155
- };
156
- }, ve = () => {
157
- var e;
158
- H = [], (e = Q.value) == null || e.validate((a) => {
159
- a && (E.value.formData.images.forEach((t) => {
160
- var r;
161
- let o = t;
162
- G.value.srcAt && (o = (t == null ? void 0 : t[G.value.srcAt]) || ""), (r = d.value) == null || r.insertContent(`<img src=${o} alt="" />`);
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
- }, b = y({
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
- }), Z = y(), ee = () => {
178
- b.value.dialogVisible = !1, b.value.formData = {
139
+ }), Q = A(), Y = () => {
140
+ w.value.dialogVisible = !1, w.value.formData = {
179
141
  name: "",
180
142
  cover: [],
181
143
  file: []
182
- }, b.value.additionalData = {};
183
- }, ge = () => {
184
- var e;
185
- (e = Z.value) == null || e.validate((a) => {
186
- var t, o;
187
- a && ((o = d.value) == null || o.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${b.value.formData.name}" data-poster="${b.value.formData.cover[0]}" src="${(t = b.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), ee());
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
- }, _ = y({
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
- }), ae = y(), te = () => {
159
+ }), Z = A(), ee = () => {
198
160
  _.value.dialogVisible = !1, _.value.formData = {
199
161
  file: []
200
162
  }, _.value.additionalData = {};
201
- }, he = () => {
202
- var e;
203
- (e = ae.value) == null || e.validate((a) => {
204
- var t, o;
205
- a && ((o = d.value) == null || o.insertContent(`<video width="auto" height="auto" controls src="${(t = _.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), te());
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
- let H = [];
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 c, f, v;
241
- let a = e;
242
- if (!((c = s.value) != null && c.handleRequest)) {
243
- g.error("缺少图片上传配置");
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 t = a.name ? a.name : "";
247
- if (!(a != null && a.name) && !(a != null && a.lastModified) && a.type === "image/png") {
248
- g.error("不允许粘贴");
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 o = yield We(a, t, {
252
- imageMaxSize: s.value.maxSize,
253
- imageAllowedType: s.value.allowedType,
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: s.value.minWidth,
256
- imageMinHeight: s.value.minHeight,
257
- imageMaxWidth: s.value.maxWidth,
258
- imageMaxHeight: s.value.maxHeight
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 (!o.success) {
261
- g.error((o == null ? void 0 : o.errorMessage) || "");
192
+ if (!t.success) {
193
+ b.error((t == null ? void 0 : t.errorMessage) || "");
262
194
  return;
263
195
  }
264
- if (o.hasTransform) {
265
- a = o.file;
266
- const p = t == null ? void 0 : t.split(".");
267
- p.pop(), t = `${p.join(",")}.jpg`;
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 de(a);
201
+ const r = yield We(e);
270
202
  if (!r.success) {
271
- g.error((r == null ? void 0 : r.errorMessage) || "压缩失败");
203
+ b.error((r == null ? void 0 : r.errorMessage) || "压缩失败");
272
204
  return;
273
205
  }
274
- const l = yield (v = (f = s.value).handleRequest) == null ? void 0 : v.call(f, ce(r.file, t), t, { extParameters: i.extParameters });
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
- g.error((l == null ? void 0 : l.errorMessage) || "");
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 X = (e) => L(this, null, function* () {
283
- var l, c, D;
284
- const a = d.value, t = e.types;
285
- if (t.includes("text/html")) {
286
- const U = e.getData("text/html"), B = new DOMParser().parseFromString(U, "text/html"), le = Array.from(B.body.querySelectorAll("img")), ke = Array.from(B.body.querySelectorAll("audio")), ze = Array.from(B.body.querySelectorAll("video"));
287
- le.length > 0 && (T.value = {
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 A of [...ke, ...ze])
292
- A == null || A.remove();
223
+ for (const k of [...Te, ...ze])
224
+ k == null || k.remove();
293
225
  try {
294
- for (var f = K([...le]), v, p, M; v = !(p = yield f.next()).done; v = !1) {
295
- const A = p.value;
296
- if (A.removeAttribute("crossorigin"), A.src.startsWith("http"))
297
- if ((l = s.value) != null && l.handleRequestByUrl) {
298
- const w = yield (c = s.value) == null ? void 0 : c.handleRequestByUrl(A.src, { extParameters: i.extParameters });
299
- w != null && w.success && (w != null && w.url) ? A.src = w == null ? void 0 : w.url : A.remove();
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 w = yield Ne(A.src);
302
- w && (w.width < (s.value.minWidth || 0) && w.height < (s.value.minHeight || 0) || w.width > (s.value.maxWidth || 0) && w.height > (s.value.maxHeight || 0)) && A.remove();
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
- A.remove(), g.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
237
+ k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
306
238
  }
307
- } catch (p) {
308
- M = [p];
239
+ } catch (qa) {
240
+ Fa = [qa];
309
241
  } finally {
310
242
  try {
311
- v && (p = f.return) && (yield p.call(f));
243
+ Ke && (qa = ie.return) && (yield qa.call(ie));
312
244
  } finally {
313
- if (M)
314
- throw M[0];
245
+ if (Fa)
246
+ throw Fa[0];
315
247
  }
316
248
  }
317
- T.value.show = !1;
318
- const Be = new XMLSerializer().serializeToString(B.body);
319
- a.insertContent(Be);
249
+ $.value.show = !1;
250
+ const Oe = new XMLSerializer().serializeToString(H.body);
251
+ e.insertContent(Oe);
320
252
  } else
321
- t.includes("text/plain") && a.insertContent(e.getData("text/plain"));
322
- const o = Array.from((e == null ? void 0 : e.files) || []), r = [];
323
- for (const U of o) {
324
- if (!U)
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 V = Le(U.name);
327
- U.type.indexOf("image") > -1 || (D = s.value.allowedType) != null && D.includes(V.toLowerCase()) ? r.push(U) : g.error("暂不支持的文件类型");
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
- T.value = {
262
+ $.value = {
331
263
  show: !0,
332
264
  text: "图片上传中,请稍等"
333
265
  };
334
266
  try {
335
- for (var q = K(r), J, ja, $a; J = !(ja = yield q.next()).done; J = !1) {
336
- const U = ja.value;
337
- const V = yield oe(U);
338
- if (V) {
339
- const B = `<img src="${V}" alt="" />`;
340
- a.insertContent(B);
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 (ja) {
344
- $a = [ja];
275
+ } catch (La) {
276
+ Ga = [La];
345
277
  } finally {
346
278
  try {
347
- J && (ja = q.return) && (yield ja.call(q));
279
+ Na && (La = Wa.return) && (yield La.call(Wa));
348
280
  } finally {
349
- if ($a)
350
- throw $a[0];
281
+ if (Ga)
282
+ throw Ga[0];
351
283
  }
352
284
  }
353
- T.value.show = !1;
285
+ $.value.show = !1;
354
286
  }
355
- n("input", a.getContent());
356
- }), ie = (e) => {
357
- var t;
358
- e.preventDefault();
359
- const a = e.clipboardData || ((t = e == null ? void 0 : e.originalEvent) == null ? void 0 : t.clipboardData);
360
- X(a);
361
- }, re = (e) => {
362
- var t;
363
- e.preventDefault();
364
- const a = e.dataTransfer || ((t = e == null ? void 0 : e.originalEvent) == null ? void 0 : t.dataTransfer);
365
- X(a);
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
- Fe(() => {
368
- var t;
369
- const e = {
299
+ Re(() => {
300
+ var a, t, r;
301
+ const o = {
370
302
  // 设置语言
371
303
  language: "zh_CN",
372
304
  // 实例
373
- target: z.value,
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 = s.value.allowedType) == null ? void 0 : t.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
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(o, r) {
454
- r == null || r.preventDefault();
385
+ paste_preprocess(l, m) {
386
+ m == null || m.preventDefault();
455
387
  },
456
- setup(o) {
457
- var l, c;
458
- const r = () => {
459
- E.value.dialogVisible = !0, setTimeout(() => {
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 (o.ui.registry.addMenuItem("localImage", {
393
+ if (l.ui.registry.addMenuItem("localImage", {
466
394
  text: "图片",
467
395
  icon: "image",
468
- onAction: () => r()
469
- }), o.ui.registry.addButton("localImage", {
396
+ onAction: () => m()
397
+ }), l.ui.registry.addButton("localImage", {
470
398
  icon: "image",
471
399
  tooltip: "图片",
472
- onAction: () => r()
473
- }), (l = h == null ? void 0 : h.value) != null && l.enable) {
400
+ onAction: () => m()
401
+ }), (d = v == null ? void 0 : v.value) != null && d.enable) {
474
402
  const f = () => {
475
- b.value.dialogVisible = !0, setTimeout(() => {
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
- o.ui.registry.addMenuItem("localAudio", {
405
+ l.ui.registry.addMenuItem("localAudio", {
482
406
  text: "音频",
483
407
  icon: "arrow-right",
484
408
  onAction: () => f()
485
- }), o.ui.registry.addButton("localAudio", {
409
+ }), l.ui.registry.addButton("localAudio", {
486
410
  icon: "arrow-right",
487
411
  tooltip: "音频",
488
412
  onAction: () => f()
489
413
  });
490
414
  }
491
- if ((c = u == null ? void 0 : u.value) != null && c.enable) {
415
+ if ((y = s == null ? void 0 : s.value) != null && y.enable) {
492
416
  const f = () => {
493
417
  _.value.dialogVisible = !0;
494
418
  };
495
- o.ui.registry.addMenuItem("localVideo", {
419
+ l.ui.registry.addMenuItem("localVideo", {
496
420
  text: "视频",
497
421
  icon: "embed",
498
422
  onAction: () => f()
499
- }), o.ui.registry.addButton("localVideo", {
423
+ }), l.ui.registry.addButton("localVideo", {
500
424
  icon: "embed",
501
425
  tooltip: "视频",
502
426
  onAction: () => f()
503
427
  });
504
428
  }
505
429
  }
506
- }, a = F(
430
+ }, e = F(
507
431
  [
508
432
  i.options,
509
- R.options,
510
- e
433
+ W.options,
434
+ o
511
435
  ],
512
436
  {
513
- mergeFunction: (o, r) => (...l) => {
514
- o(...l), r(...l);
437
+ mergeFunction: (l, m) => (...d) => {
438
+ l(...d), m(...d);
515
439
  },
516
440
  type: Object
517
441
  }
518
442
  );
519
- pe.init(a).then(([o]) => {
520
- var r;
521
- o && (o.customProps = P({}, i), o.on("input", () => {
522
- if (C.value) {
523
- C.value = !1;
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
- x.value = !0, n("input", o.getContent());
527
- }), o.on("change", () => {
528
- n("input", o.getContent());
529
- }), o.on("paste", (l) => {
530
- ie(l);
531
- }), o.on("drop", (l) => {
532
- re(l);
533
- }), (r = i.initComplete) == null || r.call(i, { editorIns: o }), d.value = o);
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
- }), Re(() => {
536
- var e, a, t, o;
537
- (e = d.value) == null || e.off("input"), (a = d.value) == null || a.off("paste"), (t = d.value) == null || t.off("drop"), (o = d.value) == null || o.destroy();
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 be = () => {
540
- var a, t;
541
- const e = P({}, b.value.additionalData || {});
542
- return ((t = (a = h.value) == null ? void 0 : a.data) == null ? void 0 : t.call(a, j(P({}, e), { extParameters: i.extParameters }))) || {};
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 a, t;
545
- const e = P({}, b.value.additionalData || {});
546
- return ((t = (a = h.value) == null ? void 0 : a.headers) == null ? void 0 : t.call(a, j(P({}, e), { extParameters: i.extParameters }))) || {};
547
- }, _e = (e, a, t) => {
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 o = (l = (r = h == null ? void 0 : h.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, e);
550
- o != null && o.url ? t[t.length - 1].url = o.url : o != null && o.errorMessage && (g.error(o.errorMessage), t.splice(t.length - 1, 1)), b.value.formData.file = t;
551
- }, De = (e, a) => new Promise((t, o) => {
552
- var l, c, f, v, p, M, D, q;
553
- const r = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
554
- if (!((c = (l = h.value) == null ? void 0 : l.allowedType) != null && c.includes(r.toLowerCase()))) {
555
- g.error(`请上传格式为${(v = (f = h.value) == null ? void 0 : f.allowedType) == null ? void 0 : v.map((J) => J.toUpperCase()).join("、")}的音频`), o();
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 (e.size > (((p = h.value) == null ? void 0 : p.maxSize) || 0) * 1024 * 1024) {
559
- g.error(`请上传${((M = h.value) == null ? void 0 : M.maxSize) || 0}M内的音频`), o();
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
- b.value.additionalData = { file: e }, (q = (D = h == null ? void 0 : h.value) == null ? void 0 : D.beforeUploadEnd) == null || q.call(D, e), t(!0);
563
- }), Ae = (e, a) => {
564
- b.value.formData.file = a;
565
- }, Te = (e, a, t) => {
566
- g.error("上传发生错误,请重试!"), b.value.formData.file = t;
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 a, t;
569
- const e = P({}, _.value.additionalData || {});
570
- return ((t = (a = u.value) == null ? void 0 : a.data) == null ? void 0 : t.call(a, j(P({}, e), { extParameters: i.extParameters }))) || {};
571
- }, Pe = () => {
572
- var a, t;
573
- const e = P({}, _.value.additionalData || {});
574
- return ((t = (a = u.value) == null ? void 0 : a.headers) == null ? void 0 : t.call(a, j(P({}, e), { extParameters: i.extParameters }))) || {};
575
- }, Se = (e, a, t) => {
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 o = (l = (r = u == null ? void 0 : u.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, e);
578
- o != null && o.url ? t[t.length - 1].url = o.url : o != null && o.errorMessage && (g.error(o.errorMessage), t.splice(t.length - 1, 1)), _.value.formData.file = t;
579
- }, Me = (e, a) => new Promise((t, o) => {
580
- var l, c, f, v, p, M, D, q;
581
- const r = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
582
- if (!((c = (l = u == null ? void 0 : u.value) == null ? void 0 : l.allowedType) != null && c.includes(r.toLowerCase()))) {
583
- g.error(`请上传格式为${(v = (f = u == null ? void 0 : u.value) == null ? void 0 : f.allowedType) == null ? void 0 : v.map((J) => J.toUpperCase()).join("、")}的视频`), o();
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 (e.size > (((p = u == null ? void 0 : u.value) == null ? void 0 : p.maxSize) || 0) * 1024 * 1024) {
587
- g.error(`请上传${((M = u == null ? void 0 : u.value) == null ? void 0 : M.maxSize) || 0}M内的视频`), o();
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: e }, (q = (D = u == null ? void 0 : u.value) == null ? void 0 : D.beforeUploadEnd) == null || q.call(D, e), t(!0);
591
- }), Ie = (e, a) => {
592
- _.value.formData.file = a;
593
- }, Ue = (e, a, t) => {
594
- g.error("上传发生错误,请重试!"), _.value.formData.file = t;
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 O(() => [i.disabled, d.value], () => {
597
- var e, a;
598
- (a = (e = d.value) == null ? void 0 : e.mode) == null || a.set(i.disabled ? "readonly" : "design");
599
- }, { immediate: !0 }), O(
600
- () => [i.value, d.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, o;
603
- if (x.value) {
604
- x.value = !1;
536
+ var o, e, a, t;
537
+ if (g.value) {
538
+ g.value = !1;
605
539
  return;
606
540
  }
607
- C.value = !0, (e = d.value) == null || e.setContent(i.value ? i.value : ""), (t = d.value) == null || t.selection.select((a = d.value) == null ? void 0 : a.getBody(), !0), (o = d.value) == null || o.selection.collapse(!1);
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: k, defaultVideoUploadOptions: I, defaultAudioUploadOptions: S, props: i, emits: n, insRef: z, editorRef: d, preventSettingContent: x, preventUpdatingModelValue: C, uploadLoadingConfig: T, mergeImageUploadOptions: s, mergeVideoUploadOptions: u, mergeAudioUploadOptions: h, mergeImgPondOptions: G, imgPondAccept: fe, uploadImageImgPondRef: W, audioImageImgPondRef: N, uploadImage: E, uploadImageFormRef: Q, onUploadImageClose: Y, onUploadImageConfirm: ve, uploadAudio: b, uploadAudioFormRef: Z, onUploadAudioClose: ee, onUploadAudioConfirm: ge, uploadVideo: _, uploadVideoFormRef: ae, onUploadVideoClose: te, onUploadVideoConfirm: he, onImageUploadUploadExceed: xe, imageUploadTempFiles: H, onImageUploadUpload: we, uploadPasteOrDropFile: oe, handleDataTransfer: X, onValuePaste: ie, onValueDrop: re, getUploadAudioData: be, getUploadAudioHeaders: ye, onUploadAudioSuccess: _e, onUploadAudioBeforeUpload: De, onUploadAudioRemove: Ae, onUploadAudioError: Te, getUploadVideoData: Ce, getUploadVideoHeaders: Pe, onUploadVideoSuccess: Se, onUploadVideoBeforeUpload: Me, onUploadVideoRemove: Ie, onUploadVideoError: Ue, ImgPond: Oe };
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
- Ha as default
548
+ $a as default
615
549
  };