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

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