@keyblade/tinymce-editor-vue2 0.1.0 → 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 ze = Object.defineProperty, Ve = Object.defineProperties;
2
- var Be = Object.getOwnPropertyDescriptors;
3
- var re = Object.getOwnPropertySymbols;
4
- var He = Object.prototype.hasOwnProperty, qe = Object.prototype.propertyIsEnumerable;
5
- var le = (u, n) => (n = Symbol[u]) ? n : Symbol.for("Symbol." + u);
6
- var ne = (u, n, i) => n in u ? ze(u, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : u[n] = i, C = (u, 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
- He.call(n, i) && ne(u, i, n[i]);
9
- if (re)
10
- for (var i of re(n))
11
- qe.call(n, i) && ne(u, i, n[i]);
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
12
  return u;
13
- }, j = (u, n) => Ve(u, Be(n));
14
- var N = (u, n, i) => new Promise((I, M) => {
15
- var P = (h) => {
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
- m(i.next(h));
18
- } catch (T) {
19
- M(T);
17
+ c(i.next(g));
18
+ } catch (I) {
19
+ T(I);
20
20
  }
21
- }, k = (h) => {
21
+ }, V = (g) => {
22
22
  try {
23
- m(i.throw(h));
24
- } catch (T) {
25
- M(T);
23
+ c(i.throw(g));
24
+ } catch (I) {
25
+ T(I);
26
26
  }
27
- }, m = (h) => h.done ? I(h.value) : Promise.resolve(h.value).then(P, k);
28
- m((i = i.apply(u, 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 X = (u, n, i) => (n = u[le("asyncIterator")]) ? n.call(u) : (u = u[le("iterator")](), n = {}, i = (I, M) => (M = u[I]) && (n[I] = (P) => new Promise((k, m, h) => (P = M.call(u, P), h = P.done, Promise.resolve(P.value).then((T) => k({ value: T, done: h }), m)))), i("next"), i("return"), n);
31
- import { defineComponent as je, ref as y, computed as E, watch as O, onMounted as Ee, onUnmounted as $e } from "vue";
32
- import { oneTravelImgPondBeforeAddFile as se, oneTravelImageCompressor as ue, oneTravelImageCheckAndTransform as Fe } from "@keyblade/one-travel";
33
- import { blobToFile as me, getImagePixel as Re, getFileExtension as We } 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 Ne from "imgpond";
36
- import { conclude as $ } from "vue-global-config";
37
- import de from "tinymce";
38
- import Oe from "./langs/zh_CN.js";
35
+ import { conclude as F } from "vue-global-config";
36
+ import pe from "tinymce";
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 F } from "./index.js";
70
- import { Message as g } from "element-ui";
71
- const Va = /* @__PURE__ */ je({
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,7 +76,6 @@ const Va = /* @__PURE__ */ je({
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
@@ -84,17 +83,18 @@ const Va = /* @__PURE__ */ je({
84
83
  emits: ["input"],
85
84
  setup(u, { emit: n }) {
86
85
  const i = u;
87
- de.addI18n("zh_CN", Oe);
88
- const I = {
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
- }, M = {
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"],
@@ -104,65 +104,27 @@ const Va = /* @__PURE__ */ je({
104
104
  maxSize: 200,
105
105
  allowedType: ["wav", "mp3", "mp4", "m4a", "wma", "aac"],
106
106
  accept: ".wav,.mp3,.mp4,.m4a,.wma,.aac"
107
- }, k = y(), m = y(), h = y(!1), T = y(!1), A = y({
107
+ }, V = A(), c = A(), g = A(!1), I = A(!1), $ = A({
108
108
  show: !1,
109
109
  text: "图片上传中,请稍等"
110
- }), s = E(() => $([i.imageUploadOptions, F.imageUploadOptions, I]) || {}), p = E(() => $([i.videoUploadOptions, F.videoUploadOptions, M]) || {}), b = E(() => $([i.audioUploadOptions, F.audioUploadOptions, P]) || {}), L = E(() => $([i.imgPondOptions, F.imgPondOptions]) || {}), ce = E(() => {
111
- var e, a;
112
- return ((a = (e = s == null ? void 0 : s.value) == null ? void 0 : e.allowedType) == null ? void 0 : a.map((o) => `.${o}`).join(",")) || "";
113
- }), R = y();
114
- O(() => R.value, () => {
115
- R.value && se(R.value, {
116
- onStart: () => {
117
- A.value = {
118
- show: !0,
119
- text: "图片加载中,请稍等"
120
- };
121
- },
122
- onSuccess: () => {
123
- A.value.show = !1;
124
- },
125
- onError: (e) => {
126
- A.value.show = !1, g.error({ message: e, customClass: "tinymce-editor-message", duration: 3e3 });
127
- }
128
- });
129
- }, { immediate: !0 });
130
- const W = y();
131
- O(() => W.value, () => {
132
- W.value && se(W.value, {
133
- onStart: () => {
134
- A.value = {
135
- show: !0,
136
- text: "图片加载中,请稍等"
137
- };
138
- },
139
- onSuccess: () => {
140
- A.value.show = !1;
141
- },
142
- onError: (e) => {
143
- A.value.show = !1, g.error(e);
144
- }
145
- });
146
- }, { immediate: !0 });
147
- const B = 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
- }), J = y(), K = () => {
153
- H = [], B.value.dialogVisible = !1, B.value.formData = {
115
+ }), j = A(), J = A(), K = () => {
116
+ E.value.dialogVisible = !1, E.value.formData = {
154
117
  images: []
155
- };
156
- }, pe = () => {
157
- var e;
158
- H = [], (e = J.value) == null || e.validate((a) => {
159
- a && (B.value.formData.images.forEach((o) => {
160
- var r;
161
- let t = o;
162
- L.value.srcAt && (t = (o == null ? void 0 : o[L.value.srcAt]) || ""), (r = m.value) == null || r.insertContent(`<img src=${t} alt="" />`);
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="" />`);
163
125
  }), K());
164
126
  });
165
- }, w = y({
127
+ }, w = A({
166
128
  dialogVisible: !1,
167
129
  formData: {
168
130
  // 名称
@@ -174,19 +136,19 @@ const Va = /* @__PURE__ */ je({
174
136
  },
175
137
  // 用于临时保存上传前的参数 { file: File }
176
138
  additionalData: {}
177
- }), Q = y(), Y = () => {
139
+ }), Q = A(), Y = () => {
178
140
  w.value.dialogVisible = !1, w.value.formData = {
179
141
  name: "",
180
142
  cover: [],
181
143
  file: []
182
- }, w.value.additionalData = {};
183
- }, fe = () => {
184
- var e;
185
- (e = Q.value) == null || e.validate((a) => {
186
- var o, t;
187
- a && ((t = m.value) == null || t.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${w.value.formData.name}" data-poster="${w.value.formData.cover[0]}" src="${(o = w.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), Y());
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 Va = /* @__PURE__ */ je({
194
156
  },
195
157
  // 用于临时保存上传前的参数 { file: File }
196
158
  additionalData: {}
197
- }), Z = y(), ee = () => {
159
+ }), Z = A(), ee = () => {
198
160
  _.value.dialogVisible = !1, _.value.formData = {
199
161
  file: []
200
162
  }, _.value.additionalData = {};
201
- }, ve = () => {
202
- var e;
203
- (e = Z.value) == null || e.validate((a) => {
204
- var o, t;
205
- a && ((t = m.value) == null || t.insertContent(`<video width="auto" height="auto" controls src="${(o = _.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), ee());
206
- });
207
163
  }, ge = () => {
208
- document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
209
- e && (e.innerHTML = `单次最多可选择${s.value.maxCount}张图片`);
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 he = (e, a) => new Promise((o, t) => N(this, null, function* () {
214
- var f, v;
215
- if (H.find((c) => (c == null ? void 0 : c.uid) === (e == null ? void 0 : e.uid)))
216
- return setTimeout(() => {
217
- document.querySelectorAll(".swal2-container").forEach((c) => {
218
- c == null || c.remove();
219
- });
220
- }), t("");
221
- H.push(e);
222
- const l = yield ue(e);
223
- if (!l.success) {
224
- t(), setTimeout(() => {
225
- a.onError(l.errorMessage);
226
- });
227
- return;
228
- }
229
- const d = yield (v = (f = s.value).handleRequest) == null ? void 0 : v.call(f, me(l.file, e.name), e.name, { extParameters: i.extParameters });
230
- if (!d || !(d != null && d.success)) {
231
- t(), setTimeout(() => {
232
- a.onError(d == null ? void 0 : d.errorMessage);
233
- });
234
- return;
235
- }
236
- o(d.url);
237
- }));
238
- function ae(e) {
239
- return N(this, null, function* () {
240
- var d, f, v;
241
- let a = e;
242
- if (!((d = s.value) != null && d.handleRequest)) {
243
- g.error("缺少图片上传配置");
170
+ function ae(o) {
171
+ return L(this, null, function* () {
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 o = 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 t = yield Fe(a, o, {
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
192
  if (!t.success) {
261
- g.error((t == null ? void 0 : t.errorMessage) || "");
193
+ b.error((t == null ? void 0 : t.errorMessage) || "");
262
194
  return;
263
195
  }
264
196
  if (t.hasTransform) {
265
- a = t.file;
266
- const c = o == null ? void 0 : o.split(".");
267
- c.pop(), o = `${c.join(",")}.jpg`;
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 ue(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, me(r.file, o), o, { 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 G = (e) => N(this, null, function* () {
283
- var l, d, z;
284
- const a = m.value, o = e.types;
285
- if (o.includes("text/html")) {
286
- const U = e.getData("text/html"), V = new DOMParser().parseFromString(U, "text/html"), ie = Array.from(V.body.querySelectorAll("img")), Ue = Array.from(V.body.querySelectorAll("audio")), Ie = Array.from(V.body.querySelectorAll("video"));
287
- ie.length > 0 && (A.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 D of [...Ue, ...Ie])
292
- D == null || D.remove();
223
+ for (const k of [...Te, ...ze])
224
+ k == null || k.remove();
293
225
  try {
294
- for (var f = X([...ie]), v, c, S; v = !(c = yield f.next()).done; v = !1) {
295
- const D = c.value;
296
- if (D.removeAttribute("crossorigin"), D.src.startsWith("http"))
297
- if ((l = s.value) != null && l.handleRequestByUrl) {
298
- const x = yield (d = s.value) == null ? void 0 : d.handleRequestByUrl(D.src, { extParameters: i.extParameters });
299
- x != null && x.success && (x != null && x.url) ? D.src = x == null ? void 0 : x.url : D.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 x = yield Re(D.src);
302
- x && (x.width < (s.value.minWidth || 0) && x.height < (s.value.minHeight || 0) || x.width > (s.value.maxWidth || 0) && x.height > (s.value.maxHeight || 0)) && D.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
- D.remove(), g.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
237
+ k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
306
238
  }
307
- } catch (c) {
308
- S = [c];
239
+ } catch (qa) {
240
+ Fa = [qa];
309
241
  } finally {
310
242
  try {
311
- v && (c = f.return) && (yield c.call(f));
243
+ Ke && (qa = ie.return) && (yield qa.call(ie));
312
244
  } finally {
313
- if (S)
314
- throw S[0];
245
+ if (Fa)
246
+ throw Fa[0];
315
247
  }
316
248
  }
317
- A.value.show = !1;
318
- const ke = new XMLSerializer().serializeToString(V.body);
319
- a.insertContent(ke);
249
+ $.value.show = !1;
250
+ const Oe = new XMLSerializer().serializeToString(H.body);
251
+ e.insertContent(Oe);
320
252
  } else
321
- o.includes("text/plain") && a.insertContent(e.getData("text/plain"));
322
- const t = Array.from((e == null ? void 0 : e.files) || []), r = [];
323
- for (const U of t) {
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 q = We(U.name);
327
- U.type.indexOf("image") > -1 || (z = s.value.allowedType) != null && z.includes(q.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
- A.value = {
262
+ $.value = {
331
263
  show: !0,
332
264
  text: "图片上传中,请稍等"
333
265
  };
334
266
  try {
335
- for (var qa = X(r), ja, Ea, $a; ja = !(Ea = yield qa.next()).done; ja = !1) {
336
- const U = Ea.value;
337
- const q = yield ae(U);
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);
338
270
  if (q) {
339
- const V = `<img src="${q}" alt="" />`;
340
- a.insertContent(V);
271
+ const H = `<img src="${q}" alt="" />`;
272
+ e.insertContent(H);
341
273
  }
342
274
  }
343
- } catch (Ea) {
344
- $a = [Ea];
275
+ } catch (La) {
276
+ Ga = [La];
345
277
  } finally {
346
278
  try {
347
- ja && (Ea = qa.return) && (yield Ea.call(qa));
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
- A.value.show = !1;
285
+ $.value.show = !1;
354
286
  }
355
- n("input", a.getContent());
356
- }), oe = (e) => {
357
- var o;
358
- e.preventDefault();
359
- const a = e.clipboardData || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.clipboardData);
360
- G(a);
361
- }, te = (e) => {
362
- var o;
363
- e.preventDefault();
364
- const a = e.dataTransfer || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.dataTransfer);
365
- G(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
- Ee(() => {
368
- var o;
369
- const e = {
299
+ Re(() => {
300
+ var a, t, r;
301
+ const o = {
370
302
  // 设置语言
371
303
  language: "zh_CN",
372
304
  // 实例
373
- target: k.value,
305
+ target: V.value,
374
306
  // 隐藏品牌
375
307
  branding: !1,
376
308
  // 隐藏右上角升级按钮
@@ -448,168 +380,170 @@ const Va = /* @__PURE__ */ je({
448
380
  convert_urls: !1,
449
381
  paste_webkit_styles: "all",
450
382
  paste_data_images: !1,
451
- images_file_types: ((o = s.value.allowedType) == null ? void 0 : o.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(t, r) {
454
- r == null || r.preventDefault();
385
+ paste_preprocess(l, m) {
386
+ m == null || m.preventDefault();
455
387
  },
456
- setup(t) {
457
- var l, d;
458
- const r = () => {
459
- B.value.dialogVisible = !0, setTimeout(() => {
460
- var v, c;
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 = ((c = s.value) == null ? void 0 : c.tipText) || "上传");
463
- });
388
+ setup(l) {
389
+ var d, y;
390
+ const m = () => {
391
+ E.value.dialogVisible = !0;
464
392
  };
465
- if (t.ui.registry.addMenuItem("localImage", {
393
+ if (l.ui.registry.addMenuItem("localImage", {
466
394
  text: "图片",
467
395
  icon: "image",
468
- onAction: () => r()
469
- }), t.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 = b == null ? void 0 : b.value) != null && l.enable) {
400
+ onAction: () => m()
401
+ }), (d = v == null ? void 0 : v.value) != null && d.enable) {
474
402
  const f = () => {
475
- w.value.dialogVisible = !0, setTimeout(() => {
476
- var c, S;
477
- const v = (c = document == null ? void 0 : document.querySelector) == null ? void 0 : c.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
478
- v && (v.innerHTML = ((S = s.value) == null ? void 0 : S.tipText) || "上传");
479
- });
403
+ w.value.dialogVisible = !0;
480
404
  };
481
- t.ui.registry.addMenuItem("localAudio", {
405
+ l.ui.registry.addMenuItem("localAudio", {
482
406
  text: "音频",
483
407
  icon: "arrow-right",
484
408
  onAction: () => f()
485
- }), t.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 ((d = p == null ? void 0 : p.value) != null && d.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
- t.ui.registry.addMenuItem("localVideo", {
419
+ l.ui.registry.addMenuItem("localVideo", {
496
420
  text: "视频",
497
421
  icon: "embed",
498
422
  onAction: () => f()
499
- }), t.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 = $(
430
+ }, e = F(
507
431
  [
508
432
  i.options,
509
- F.options,
510
- e
433
+ W.options,
434
+ o
511
435
  ],
512
436
  {
513
- mergeFunction: (t, r) => (...l) => {
514
- t(...l), r(...l);
437
+ mergeFunction: (l, m) => (...d) => {
438
+ l(...d), m(...d);
515
439
  },
516
440
  type: Object
517
441
  }
518
442
  );
519
- de.init(a).then(([t]) => {
520
- var r;
521
- t && (t.customProps = C({}, i), t.on("input", () => {
522
- if (T.value) {
523
- T.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
- h.value = !0, n("input", t.getContent());
527
- }), t.on("change", () => {
528
- n("input", t.getContent());
529
- }), t.on("paste", (l) => {
530
- oe(l);
531
- }), t.on("drop", (l) => {
532
- te(l);
533
- }), (r = i.initComplete) == null || r.call(i, { editorIns: t }), m.value = t);
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
- }), $e(() => {
536
- var e, a, o, t;
537
- (e = m.value) == null || e.off("input"), (a = m.value) == null || a.off("paste"), (o = m.value) == null || o.off("drop"), (t = m.value) == null || t.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 xe = () => {
540
- var a, o;
541
- const e = C({}, w.value.additionalData || {});
542
- return ((o = (a = b.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, j(C({}, 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 });
543
473
  }, we = () => {
544
- var a, o;
545
- const e = C({}, w.value.additionalData || {});
546
- return ((o = (a = b.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, j(C({}, e), { extParameters: i.extParameters }))) || {};
547
- }, be = (e, a, o) => {
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 }))) || {};
477
+ }, ye = () => {
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 t = (l = (r = b == null ? void 0 : b.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, e);
550
- t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (g.error(t.errorMessage), o.splice(o.length - 1, 1)), w.value.formData.file = o;
551
- }, ye = (e, a) => new Promise((o, t) => {
552
- var l, d, f, v, c, S;
553
- const r = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
554
- if (!((d = (l = b.value) == null ? void 0 : l.allowedType) != null && d.includes(r.toLowerCase()))) {
555
- g.error(`请上传格式为${(v = (f = b.value) == null ? void 0 : f.allowedType) == null ? void 0 : v.map((z) => z.toUpperCase()).join("、")}的音频`), t();
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 > (((c = b.value) == null ? void 0 : c.maxSize) || 0) * 1024 * 1024) {
559
- g.error(`请上传${((S = b.value) == null ? void 0 : S.maxSize) || 0}M内的音频`), t();
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
- w.value.additionalData = { file: e }, o(!0);
563
- }), _e = (e, a) => {
564
- w.value.formData.file = a;
565
- }, De = (e, a, o) => {
566
- g.error("上传发生错误,请重试!"), w.value.formData.file = o;
567
- }, Ae = () => {
568
- var a, o;
569
- const e = C({}, _.value.additionalData || {});
570
- return ((o = (a = p.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, j(C({}, e), { extParameters: i.extParameters }))) || {};
571
- }, Te = () => {
572
- var a, o;
573
- const e = C({}, _.value.additionalData || {});
574
- return ((o = (a = p.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, j(C({}, e), { extParameters: i.extParameters }))) || {};
575
- }, Ce = (e, a, o) => {
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;
501
+ }, Ce = () => {
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 t = (l = (r = p == null ? void 0 : p.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, e);
578
- t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (g.error(t.errorMessage), o.splice(o.length - 1, 1)), _.value.formData.file = o;
579
- }, Pe = (e, a) => new Promise((o, t) => {
580
- var l, d, f, v, c, S;
581
- const r = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
582
- if (!((d = (l = p == null ? void 0 : p.value) == null ? void 0 : l.allowedType) != null && d.includes(r.toLowerCase()))) {
583
- g.error(`请上传格式为${(v = (f = p == null ? void 0 : p.value) == null ? void 0 : f.allowedType) == null ? void 0 : v.map((z) => z.toUpperCase()).join("、")}的视频`), t();
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 > (((c = p == null ? void 0 : p.value) == null ? void 0 : c.maxSize) || 0) * 1024 * 1024) {
587
- g.error(`请上传${((S = p == null ? void 0 : p.value) == null ? void 0 : S.maxSize) || 0}M内的视频`), t();
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 }, o(!0);
591
- }), Se = (e, a) => {
592
- _.value.formData.file = a;
593
- }, Me = (e, a, o) => {
594
- g.error("上传发生错误,请重试!"), _.value.formData.file = o;
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, m.value], () => {
597
- var e, a;
598
- (a = (e = m.value) == null ? void 0 : e.mode) == null || a.set(i.disabled ? "readonly" : "design");
599
- }, { immediate: !0 }), O(
600
- () => [i.value, m.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, o, t;
603
- if (h.value) {
604
- h.value = !1;
536
+ var o, e, a, t;
537
+ if (g.value) {
538
+ g.value = !1;
605
539
  return;
606
540
  }
607
- T.value = !0, (e = m.value) == null || e.setContent(i.value ? i.value : ""), (o = m.value) == null || o.selection.select((a = m.value) == null ? void 0 : a.getBody(), !0), (t = m.value) == null || t.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: I, defaultVideoUploadOptions: M, defaultAudioUploadOptions: P, props: i, emits: n, insRef: k, editorRef: m, preventSettingContent: h, preventUpdatingModelValue: T, uploadLoadingConfig: A, mergeImageUploadOptions: s, mergeVideoUploadOptions: p, mergeAudioUploadOptions: b, mergeImgPondOptions: L, imgPondAccept: ce, uploadImageImgPondRef: R, audioImageImgPondRef: W, uploadImage: B, uploadImageFormRef: J, onUploadImageClose: K, onUploadImageConfirm: pe, uploadAudio: w, uploadAudioFormRef: Q, onUploadAudioClose: Y, onUploadAudioConfirm: fe, uploadVideo: _, uploadVideoFormRef: Z, onUploadVideoClose: ee, onUploadVideoConfirm: ve, onImageUploadUploadExceed: ge, imageUploadTempFiles: H, onImageUploadUpload: he, uploadPasteOrDropFile: ae, handleDataTransfer: G, onValuePaste: oe, onValueDrop: te, getUploadAudioData: xe, getUploadAudioHeaders: we, onUploadAudioSuccess: be, onUploadAudioBeforeUpload: ye, onUploadAudioRemove: _e, onUploadAudioError: De, getUploadVideoData: Ae, getUploadVideoHeaders: Te, onUploadVideoSuccess: Ce, onUploadVideoBeforeUpload: Pe, onUploadVideoRemove: Se, onUploadVideoError: Me, ImgPond: Ne };
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
- Va as default
548
+ $a as default
615
549
  };