@keyblade/tinymce-editor-vue2 0.0.12-alpha.50 → 0.0.12-alpha.51

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