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

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.
Files changed (2) hide show
  1. package/es/editor.vue2.js +176 -282
  2. package/package.json +2 -2
package/es/editor.vue2.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as De, ref as y, computed as C, watch as z, onMounted as Ae, onUnmounted as Ce } from "vue";
2
- import { oneTravelImgPondBeforeAddFile as K, oneTravelImageCompressor as Q, oneTravelImageCheckAndTransform as Te } from "@keyblade/one-travel";
3
- import { blobToFile as Y, generateUUID as Pe, getImagePixel as Z, getFileExtension as ee } from "./util.js";
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";
4
4
  import "./style.less.js";
5
- import Me from "imgpond";
5
+ import Te from "imgpond";
6
6
  import { conclude as T } from "vue-global-config";
7
- import ae from "tinymce";
8
- import Se from "./langs/zh_CN.js";
7
+ import Y from "tinymce";
8
+ import Pe 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";
@@ -35,8 +35,8 @@ import "tinymce/plugins/visualblocks";
35
35
  import "tinymce/plugins/visualchars";
36
36
  import "tinymce/plugins/wordcount";
37
37
  import { globalProps as P } from "./index.js";
38
- import { Message as f } from "element-ui";
39
- const va = /* @__PURE__ */ De({
38
+ import { Message as p } from "element-ui";
39
+ const pa = /* @__PURE__ */ be({
40
40
  __name: "editor",
41
41
  props: {
42
42
  value: { default: "" },
@@ -50,10 +50,10 @@ const va = /* @__PURE__ */ De({
50
50
  initComplete: null
51
51
  },
52
52
  emits: ["input"],
53
- setup(te, { emit: M }) {
54
- const m = te;
55
- ae.addI18n("zh_CN", Se);
56
- const B = {
53
+ setup(Z, { emit: M }) {
54
+ const s = Z;
55
+ Y.addI18n("zh_CN", Pe);
56
+ const j = {
57
57
  maxCount: 10,
58
58
  tipText: "上传",
59
59
  maxSize: 30,
@@ -62,7 +62,7 @@ const va = /* @__PURE__ */ De({
62
62
  minHeight: 50,
63
63
  maxWidth: 6e3,
64
64
  maxHeight: 6e3
65
- }, j = {
65
+ }, B = {
66
66
  enable: !0,
67
67
  maxSize: 300,
68
68
  allowedType: ["mp4", "3gp"],
@@ -72,65 +72,65 @@ const va = /* @__PURE__ */ De({
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 = y(), h = y(), S = y(!1), U = y(!1), v = y({
75
+ }, E = b(), h = b(), S = b(!1), k = b(!1), f = b({
76
76
  show: !1,
77
77
  text: "图片上传中,请稍等"
78
- }), r = C(() => T([m.imageUploadOptions, P.imageUploadOptions, B]) || {}), c = C(() => T([m.videoUploadOptions, P.videoUploadOptions, j]) || {}), w = C(() => T([m.audioUploadOptions, P.audioUploadOptions, q]) || {}), H = C(() => T([m.imgPondOptions, P.imgPondOptions]) || {}), oe = C(() => {
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(() => {
79
79
  var e, a;
80
80
  return ((a = (e = r == null ? void 0 : r.value) == null ? void 0 : e.allowedType) == null ? void 0 : a.map((o) => `.${o}`).join(",")) || "";
81
- }), I = y();
82
- z(() => I.value, () => {
83
- I.value && K(I.value, {
81
+ }), U = b();
82
+ z(() => U.value, () => {
83
+ U.value && J(U.value, {
84
84
  onStart: () => {
85
- v.value = {
85
+ f.value = {
86
86
  show: !0,
87
87
  text: "图片加载中,请稍等"
88
88
  };
89
89
  },
90
90
  onSuccess: () => {
91
- v.value.show = !1;
91
+ f.value.show = !1;
92
92
  },
93
93
  onError: (e) => {
94
- v.value.show = !1, f.error({ message: e, customClass: "tinymce-editor-message", duration: 2e4 });
94
+ f.value.show = !1, p.error({ message: e, customClass: "tinymce-editor-message", duration: 2e4 });
95
95
  }
96
96
  });
97
97
  }, { immediate: !0 });
98
- const k = y();
99
- z(() => k.value, () => {
100
- k.value && K(k.value, {
98
+ const I = b();
99
+ z(() => I.value, () => {
100
+ I.value && J(I.value, {
101
101
  onStart: () => {
102
- v.value = {
102
+ f.value = {
103
103
  show: !0,
104
104
  text: "图片加载中,请稍等"
105
105
  };
106
106
  },
107
107
  onSuccess: () => {
108
- v.value.show = !1;
108
+ f.value.show = !1;
109
109
  },
110
110
  onError: (e) => {
111
- v.value.show = !1, f.error(e);
111
+ f.value.show = !1, p.error(e);
112
112
  }
113
113
  });
114
114
  }, { immediate: !0 });
115
- const A = y({
115
+ const A = b({
116
116
  dialogVisible: !1,
117
117
  formData: {
118
118
  images: []
119
119
  }
120
- }), $ = y(), R = () => {
120
+ }), $ = b(), R = () => {
121
121
  A.value.dialogVisible = !1, A.value.formData = {
122
122
  images: []
123
123
  };
124
- }, ie = () => {
124
+ }, ae = () => {
125
125
  var e;
126
126
  (e = $.value) == null || e.validate((a) => {
127
127
  a && (A.value.formData.images.forEach((o) => {
128
- var l;
128
+ var i;
129
129
  let t = o;
130
- H.value.srcAt && (t = (o == null ? void 0 : o[H.value.srcAt]) || ""), (l = h.value) == null || l.insertContent(`<img src=${t} alt="" />`);
130
+ V.value.srcAt && (t = (o == null ? void 0 : o[V.value.srcAt]) || ""), (i = h.value) == null || i.insertContent(`<img src=${t} alt="" />`);
131
131
  }), R());
132
132
  });
133
- }, x = y({
133
+ }, x = b({
134
134
  dialogVisible: !1,
135
135
  formData: {
136
136
  // 名称
@@ -142,19 +142,19 @@ const va = /* @__PURE__ */ De({
142
142
  },
143
143
  // 用于临时保存上传前的参数 { file: File }
144
144
  additionalData: {}
145
- }), F = y(), N = () => {
145
+ }), W = b(), F = () => {
146
146
  x.value.dialogVisible = !1, x.value.formData = {
147
147
  name: "",
148
148
  cover: [],
149
149
  file: []
150
150
  }, x.value.additionalData = {};
151
- }, le = () => {
151
+ }, oe = () => {
152
152
  var e;
153
- (e = F.value) == null || e.validate((a) => {
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>`), N());
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());
156
156
  });
157
- }, _ = y({
157
+ }, y = b({
158
158
  dialogVisible: !1,
159
159
  formData: {
160
160
  // 文件
@@ -162,86 +162,55 @@ const va = /* @__PURE__ */ De({
162
162
  },
163
163
  // 用于临时保存上传前的参数 { file: File }
164
164
  additionalData: {}
165
- }), O = y(), L = () => {
166
- _.value.dialogVisible = !1, _.value.formData = {
165
+ }), N = b(), O = () => {
166
+ y.value.dialogVisible = !1, y.value.formData = {
167
167
  file: []
168
- }, _.value.additionalData = {};
169
- }, ne = () => {
168
+ }, y.value.additionalData = {};
169
+ }, te = () => {
170
170
  var e;
171
- (e = O.value) == null || e.validate((a) => {
171
+ (e = N.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 = _.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), L());
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());
174
174
  });
175
- }, re = () => {
175
+ }, ie = () => {
176
176
  document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
177
177
  e && (e.innerHTML = `单次最多可选择${r.value.maxCount}张图片`);
178
178
  });
179
- }, se = (e, a) => new Promise(async (o, t) => {
180
- var d, n;
181
- const l = await Q(e);
182
- if (!l.success) {
179
+ }, le = (e, a) => new Promise(async (o, t) => {
180
+ var c, n;
181
+ const i = await K(e);
182
+ if (!i.success) {
183
183
  t(), setTimeout(() => {
184
- a.onError(l.errorMessage);
184
+ a.onError(i.errorMessage);
185
185
  });
186
186
  return;
187
187
  }
188
- const i = await ((n = (d = r.value).handleRequest) == null ? void 0 : n.call(d, Y(l.file, e.name), e.name, { extParameters: m.extParameters }));
189
- if (!i || !(i != null && i.success)) {
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)) {
190
190
  t(), setTimeout(() => {
191
- a.onError(i == null ? void 0 : i.errorMessage);
191
+ a.onError(l == null ? void 0 : l.errorMessage);
192
192
  });
193
193
  return;
194
194
  }
195
- o(i.url);
195
+ o(l.url);
196
196
  });
197
- async function ue(e, a) {
198
- const t = a.node.getElementsByTagName("img"), l = [];
199
- for (let i = t.length - 1; i >= 0; i--) {
200
- const d = t[i], n = "img-" + Pe();
201
- d.classList.add(n), l.push(n);
202
- }
203
- setTimeout(async () => {
204
- var i, d;
205
- for (let n = l.length - 1; n >= 0; n--) {
206
- const u = e.dom.select(`.${l[n]}`);
207
- if (u.length === 0)
208
- continue;
209
- const s = u[0], p = s.src;
210
- if (p.startsWith("data:image")) {
211
- e.dom.remove(s);
212
- continue;
213
- } else if (p.startsWith("http://") || p.startsWith("https://")) {
214
- const b = await Z(p);
215
- if (b && (b.width < (r.value.minWidth || 0) && b.height < (r.value.minHeight || 0) || b.width > (r.value.maxWidth || 0) && b.height > (r.value.maxHeight || 0))) {
216
- e.dom.remove(s);
217
- continue;
218
- }
219
- const W = ee(p);
220
- if (!((d = (i = r.value) == null ? void 0 : i.allowedType) != null && d.includes(W.toLowerCase()))) {
221
- e.dom.remove(s);
222
- continue;
223
- }
224
- }
225
- }
226
- });
227
- }
228
- async function G(e) {
229
- var d, n, u;
197
+ async function L(e) {
198
+ var c, n, d;
230
199
  let a = e;
231
- if (!((d = r.value) != null && d.handleRequest)) {
232
- f.error("缺少图片上传配置");
200
+ if (!((c = r.value) != null && c.handleRequest)) {
201
+ p.error("缺少图片上传配置");
233
202
  return;
234
203
  }
235
- v.value = {
204
+ f.value = {
236
205
  show: !0,
237
206
  text: "图片上传中,请稍等"
238
207
  };
239
208
  let o = a.name ? a.name : "";
240
209
  if (!(a != null && a.name) && !(a != null && a.lastModified) && a.type === "image/png") {
241
- v.value.show = !1, f.error("不允许粘贴");
210
+ f.value.show = !1, p.error("不允许粘贴");
242
211
  return;
243
212
  }
244
- const t = await Te(a, o, {
213
+ const t = await De(a, o, {
245
214
  imageMaxSize: r.value.maxSize,
246
215
  imageAllowedType: r.value.allowedType,
247
216
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
@@ -251,80 +220,80 @@ const va = /* @__PURE__ */ De({
251
220
  imageMaxHeight: r.value.maxHeight
252
221
  });
253
222
  if (!t.success) {
254
- v.value.show = !1, f.error((t == null ? void 0 : t.errorMessage) || "");
223
+ f.value.show = !1, p.error((t == null ? void 0 : t.errorMessage) || "");
255
224
  return;
256
225
  }
257
226
  if (t.hasTransform) {
258
227
  a = t.file;
259
- const s = o == null ? void 0 : o.split(".");
260
- s.pop(), o = `${s.join(",")}.jpg`;
228
+ const m = o == null ? void 0 : o.split(".");
229
+ m.pop(), o = `${m.join(",")}.jpg`;
261
230
  }
262
- const l = await Q(a);
263
- if (!l.success) {
264
- v.value.show = !1, f.error((l == null ? void 0 : l.errorMessage) || "压缩失败");
231
+ const i = await K(a);
232
+ if (!i.success) {
233
+ f.value.show = !1, p.error((i == null ? void 0 : i.errorMessage) || "压缩失败");
265
234
  return;
266
235
  }
267
- const i = await ((u = (n = r.value).handleRequest) == null ? void 0 : u.call(n, Y(l.file, o), o, { extParameters: m.extParameters }));
268
- if (!i || !i.success) {
269
- v.value.show = !1, f.error((i == null ? void 0 : i.errorMessage) || "");
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) || "");
270
239
  return;
271
240
  }
272
- return v.value.show = !1, i.url;
241
+ return f.value.show = !1, l.url;
273
242
  }
274
- const V = async (e) => {
275
- var l, i, d;
243
+ const H = async (e) => {
244
+ var i, l, c;
276
245
  const a = h.value, o = e.types;
277
246
  if (o.includes("text/html")) {
278
- const n = e.getData("text/html"), s = new DOMParser().parseFromString(n, "text/html"), p = Array.from(s.body.querySelectorAll("img")), b = Array.from(s.body.querySelectorAll("audio")), W = Array.from(s.body.querySelectorAll("video"));
279
- p.length > 0 && (v.value = {
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 = {
280
249
  show: !0,
281
250
  text: "图片加载中,请稍等"
282
251
  });
283
- for (const D of [...b, ...W])
284
- D == null || D.remove();
285
- for await (const D of [...p])
286
- if (D.removeAttribute("crossorigin"), D.src.startsWith("http"))
287
- if ((l = r.value) != null && l.handleRequestByUrl) {
288
- const g = await ((i = r.value) == null ? void 0 : i.handleRequestByUrl(D.src, { extParameters: m.extParameters }));
289
- g != null && g.success && (g != null && g.url) ? D.src = g == null ? void 0 : g.url : D.remove();
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();
290
259
  } else {
291
- const g = await Z(D.src);
292
- 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)) && D.remove();
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();
293
262
  }
294
263
  else
295
- D.remove(), f.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
296
- v.value.show = !1;
297
- const _e = new XMLSerializer().serializeToString(s.body);
298
- a.insertContent(_e);
264
+ _.remove(), p.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
265
+ f.value.show = !1;
266
+ const we = new XMLSerializer().serializeToString(m.body);
267
+ a.insertContent(we);
299
268
  } else
300
269
  o.includes("text/plain") && a.insertContent(e.getData("text/plain"));
301
270
  const t = Array.from(e.items);
302
271
  for await (const n of t) {
303
- const u = n.getAsFile();
304
- if (!u)
272
+ const d = n.getAsFile();
273
+ if (!d)
305
274
  continue;
306
- const s = ee(u.name);
307
- if (u.type.indexOf("image") > -1 || (d = r.value.allowedType) != null && d.includes(s.toLowerCase())) {
308
- const p = await G(u);
309
- if (p) {
310
- const b = `<img src="${p}" alt="" />`;
311
- a.insertContent(b);
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);
312
281
  }
313
282
  }
314
283
  }
315
284
  M("input", a.getContent());
316
- }, X = (e) => {
285
+ }, G = (e) => {
317
286
  var o;
318
287
  e.preventDefault();
319
288
  const a = e.clipboardData || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.clipboardData);
320
- V(a);
321
- }, J = (e) => {
289
+ H(a);
290
+ }, X = (e) => {
322
291
  var o;
323
292
  e.preventDefault();
324
293
  const a = e.dataTransfer || ((o = e == null ? void 0 : e.originalEvent) == null ? void 0 : o.dataTransfer);
325
- V(a);
294
+ H(a);
326
295
  };
327
- Ae(() => {
296
+ ye(() => {
328
297
  var o;
329
298
  const e = {
330
299
  // 设置语言
@@ -410,107 +379,32 @@ const va = /* @__PURE__ */ De({
410
379
  paste_data_images: !1,
411
380
  images_file_types: ((o = r.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
412
381
  // 粘贴前处理
413
- paste_preprocess(t, l) {
414
- l == null || l.preventDefault();
382
+ paste_preprocess(t, i) {
383
+ i == null || i.preventDefault();
415
384
  },
416
- // // 粘贴后处理(处理异步操作)
417
- // paste_postprocess(editor, args) {
418
- // // 处理图片
419
- // processPastedImage(editor, args)
420
- // },
421
- // images_upload_handler(blobInfo) {
422
- // // eslint-disable-next-line no-async-promise-executor
423
- // return new Promise(async (resolve, reject) => {
424
- // // 校验图片配置
425
- // if (!mergeImageUploadOptions.value?.handleRequest) {
426
- // removeNotification()
427
- // return reject({ message: '缺少图片上传配置', remove: true })
428
- // }
429
- //
430
- // uploadLoadingConfig.value = {
431
- // show: true,
432
- // text: '图片上传中,请稍等'
433
- // }
434
- //
435
- // // 获取文件 blob 数据
436
- // // 1.从本地复制图片都是 File 对象,chrome 复制非图片文件,都是 blob,且为 png
437
- // let file = blobInfo.blob()
438
- // // 有名称,则取真实名称
439
- // let filename = (file as File).name ? (file as File).name : blobInfo.filename()
440
- // if (!(file as File)?.name && !(file as File)?.lastModified && file.type === 'image/png') {// chrome 复制非图片格式
441
- // uploadLoadingConfig.value.show = false
442
- // removeNotification()
443
- // return reject({ message: '不允许粘贴', remove: true })
444
- // }
445
- //
446
- // // 图片校验
447
- // const checkRes = await oneTravelImageCheckAndTransform(file, filename, {
448
- // imageMaxSize: mergeImageUploadOptions.value.maxSize,
449
- // imageAllowedType: mergeImageUploadOptions.value.allowedType,
450
- // imageMinWidth: mergeImageUploadOptions.value.minWidth,
451
- // imageMinHeight: mergeImageUploadOptions.value.minHeight,
452
- // imageMaxWidth: mergeImageUploadOptions.value.maxWidth,
453
- // imageMaxHeight: mergeImageUploadOptions.value.maxHeight
454
- // })
455
- // if (!checkRes.success) {
456
- // uploadLoadingConfig.value.show = false
457
- // removeNotification()
458
- // return reject({ message: checkRes?.errorMessage || '', remove: true })
459
- // }
460
- // if (checkRes.hasTransform) {// 被转换
461
- // // 修改文件
462
- // file = checkRes.file!
463
- //
464
- // // 修改名称
465
- // const arr = filename?.split('.')
466
- // arr.pop()
467
- // const prefix = arr.join(',')
468
- // filename = `${prefix}.jpg`
469
- // }
470
- //
471
- // // 图片压缩
472
- // const compressorRes = await oneTravelImageCompressor(file)
473
- // if (!compressorRes.success) {
474
- // uploadLoadingConfig.value.show = false
475
- // removeNotification()
476
- // return reject({ message: compressorRes?.errorMessage, remove: true })
477
- // }
478
- //
479
- // // 上传图片
480
- // const uploadRes = await mergeImageUploadOptions.value.handleRequest?.(blobToFile(compressorRes.file, filename), filename, { extParameters: props.extParameters })
481
- // if (!uploadRes || !uploadRes.success) {
482
- // uploadLoadingConfig.value.show = false
483
- // removeNotification()
484
- // return reject({ message: uploadRes.errorMessage, remove: true })
485
- // }
486
- //
487
- // uploadLoadingConfig.value.show = false
488
- // resolve(uploadRes.url!)
489
- // })
490
- // },
491
385
  setup(t) {
492
- var i, d;
493
- const l = () => {
386
+ var l, c;
387
+ const i = () => {
494
388
  A.value.dialogVisible = !0, setTimeout(() => {
495
- var u, s;
496
- const n = (u = document == null ? void 0 : document.querySelector) == null ? void 0 : u.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
497
- n && (n.innerHTML = ((s = r.value) == null ? void 0 : s.tipText) || "上传");
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) || "上传");
498
392
  });
499
393
  };
500
394
  if (t.ui.registry.addMenuItem("localImage", {
501
395
  text: "图片",
502
396
  icon: "image",
503
- onAction: () => l()
397
+ onAction: () => i()
504
398
  }), t.ui.registry.addButton("localImage", {
505
399
  icon: "image",
506
400
  tooltip: "图片",
507
- onAction: () => l()
508
- }), (i = w == null ? void 0 : w.value) != null && i.enable) {
401
+ onAction: () => i()
402
+ }), (l = w == null ? void 0 : w.value) != null && l.enable) {
509
403
  const n = () => {
510
404
  x.value.dialogVisible = !0, setTimeout(() => {
511
- var s, p;
512
- const u = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
513
- u && (u.innerHTML = ((p = r.value) == null ? void 0 : p.tipText) || "上传");
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) || "上传");
514
408
  });
515
409
  };
516
410
  t.ui.registry.addMenuItem("localAudio", {
@@ -523,9 +417,9 @@ const va = /* @__PURE__ */ De({
523
417
  onAction: () => n()
524
418
  });
525
419
  }
526
- if ((d = c == null ? void 0 : c.value) != null && d.enable) {
420
+ if ((c = u == null ? void 0 : u.value) != null && c.enable) {
527
421
  const n = () => {
528
- _.value.dialogVisible = !0;
422
+ y.value.dialogVisible = !0;
529
423
  };
530
424
  t.ui.registry.addMenuItem("localVideo", {
531
425
  text: "视频",
@@ -540,111 +434,111 @@ const va = /* @__PURE__ */ De({
540
434
  }
541
435
  }, a = T(
542
436
  [
543
- m.options,
437
+ s.options,
544
438
  P.options,
545
439
  e
546
440
  ],
547
441
  {
548
- mergeFunction: (t, l) => (...i) => {
549
- t(...i), l(...i);
442
+ mergeFunction: (t, i) => (...l) => {
443
+ t(...l), i(...l);
550
444
  },
551
445
  type: Object
552
446
  }
553
447
  );
554
- ae.init(a).then(([t]) => {
555
- var l;
556
- t && (t.customProps = { ...m }, t.on("input", () => {
557
- if (U.value) {
558
- U.value = !1;
448
+ Y.init(a).then(([t]) => {
449
+ var i;
450
+ t && (t.customProps = { ...s }, t.on("input", () => {
451
+ if (k.value) {
452
+ k.value = !1;
559
453
  return;
560
454
  }
561
455
  S.value = !0, M("input", t.getContent());
562
456
  }), t.on("change", () => {
563
457
  M("input", t.getContent());
564
- }), t.on("paste", (i) => {
565
- X(i);
566
- }), t.on("drop", (i) => {
567
- J(i);
568
- }), (l = m.initComplete) == null || l.call(m, { editorIns: t }), h.value = t);
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);
569
463
  });
570
- }), Ce(() => {
464
+ }), _e(() => {
571
465
  var e, a, o, t;
572
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();
573
467
  });
574
- const me = () => {
468
+ const re = () => {
575
469
  var a, o;
576
470
  const e = { ...x.value.additionalData || {} };
577
- return ((o = (a = w.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: m.extParameters })) || {};
578
- }, de = () => {
471
+ return ((o = (a = w.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: s.extParameters })) || {};
472
+ }, ne = () => {
579
473
  var a, o;
580
474
  const e = { ...x.value.additionalData || {} };
581
- return ((o = (a = w.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: m.extParameters })) || {};
582
- }, ce = (e, a, o) => {
583
- var l, i;
584
- const t = (i = (l = w == null ? void 0 : w.value) == null ? void 0 : l.handlerResponse) == null ? void 0 : i.call(l, e);
585
- t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (f.error(t.errorMessage), o.splice(o.length - 1, 1)), x.value.formData.file = o;
586
- }, pe = (e, a) => new Promise((o, t) => {
587
- var i, d, n, u, s, p;
588
- const l = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
589
- if (!((d = (i = w.value) == null ? void 0 : i.allowedType) != null && d.includes(l.toLowerCase()))) {
590
- f.error(`请上传格式为${(u = (n = w.value) == null ? void 0 : n.allowedType) == null ? void 0 : u.map((b) => b.toUpperCase()).join("、")}的音频`), t();
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;
482
+ 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();
591
485
  return;
592
486
  }
593
- if (e.size > (((s = w.value) == null ? void 0 : s.maxSize) || 0) * 1024 * 1024) {
594
- f.error(`请上传${((p = w.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), t();
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();
595
489
  return;
596
490
  }
597
491
  x.value.additionalData = { file: e }, o(!0);
598
- }), fe = (e, a) => {
492
+ }), me = (e, a) => {
599
493
  x.value.formData.file = a;
600
- }, ve = (e, a, o) => {
601
- f.error("上传发生错误,请重试!"), x.value.formData.file = o;
602
- }, ge = () => {
494
+ }, de = (e, a, o) => {
495
+ p.error("上传发生错误,请重试!"), x.value.formData.file = o;
496
+ }, ce = () => {
603
497
  var a, o;
604
- const e = { ..._.value.additionalData || {} };
605
- return ((o = (a = c.value) == null ? void 0 : a.data) == null ? void 0 : o.call(a, { ...e, extParameters: m.extParameters })) || {};
606
- }, he = () => {
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 })) || {};
500
+ }, pe = () => {
607
501
  var a, o;
608
- const e = { ..._.value.additionalData || {} };
609
- return ((o = (a = c.value) == null ? void 0 : a.headers) == null ? void 0 : o.call(a, { ...e, extParameters: m.extParameters })) || {};
610
- }, xe = (e, a, o) => {
611
- var l, i;
612
- const t = (i = (l = c == null ? void 0 : c.value) == null ? void 0 : l.handlerResponse) == null ? void 0 : i.call(l, e);
613
- t != null && t.url ? o[o.length - 1].url = t.url : t != null && t.errorMessage && (f.error(t.errorMessage), o.splice(o.length - 1, 1)), _.value.formData.file = o;
614
- }, we = (e, a) => new Promise((o, t) => {
615
- var i, d, n, u, s, p;
616
- const l = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
617
- if (!((d = (i = c == null ? void 0 : c.value) == null ? void 0 : i.allowedType) != null && d.includes(l.toLowerCase()))) {
618
- f.error(`请上传格式为${(u = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) == null ? void 0 : u.map((b) => b.toUpperCase()).join("、")}的视频`), t();
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 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();
619
513
  return;
620
514
  }
621
- if (e.size > (((s = c == null ? void 0 : c.value) == null ? void 0 : s.maxSize) || 0) * 1024 * 1024) {
622
- f.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), t();
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();
623
517
  return;
624
518
  }
625
- _.value.additionalData = { file: e }, o(!0);
626
- }), be = (e, a) => {
627
- _.value.formData.file = a;
628
- }, ye = (e, a, o) => {
629
- f.error("上传发生错误,请重试!"), _.value.formData.file = o;
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;
630
524
  };
631
- return z(() => [m.disabled, h.value], () => {
525
+ return z(() => [s.disabled, h.value], () => {
632
526
  var e, a;
633
- (a = (e = h.value) == null ? void 0 : e.mode) == null || a.set(m.disabled ? "readonly" : "design");
527
+ (a = (e = h.value) == null ? void 0 : e.mode) == null || a.set(s.disabled ? "readonly" : "design");
634
528
  }, { immediate: !0 }), z(
635
- () => [m.value, h.value],
529
+ () => [s.value, h.value],
636
530
  () => {
637
531
  var e;
638
532
  if (S.value) {
639
533
  S.value = !1;
640
534
  return;
641
535
  }
642
- U.value = !0, (e = h.value) == null || e.setContent(m.value ? m.value : "");
536
+ k.value = !0, (e = h.value) == null || e.setContent(s.value ? s.value : "");
643
537
  },
644
538
  { immediate: !0 }
645
- ), { __sfc: !0, defaultImageUploadOptions: B, defaultVideoUploadOptions: j, defaultAudioUploadOptions: q, props: m, emits: M, insRef: E, editorRef: h, preventSettingContent: S, preventUpdatingModelValue: U, uploadLoadingConfig: v, mergeImageUploadOptions: r, mergeVideoUploadOptions: c, mergeAudioUploadOptions: w, mergeImgPondOptions: H, imgPondAccept: oe, uploadImageImgPondRef: I, audioImageImgPondRef: k, uploadImage: A, uploadImageFormRef: $, onUploadImageClose: R, onUploadImageConfirm: ie, uploadAudio: x, uploadAudioFormRef: F, onUploadAudioClose: N, onUploadAudioConfirm: le, uploadVideo: _, uploadVideoFormRef: O, onUploadVideoClose: L, onUploadVideoConfirm: ne, onImageUploadUploadExceed: re, onImageUploadUpload: se, processPastedImage: ue, uploadPasteOrDropFile: G, handleDataTransfer: V, onValuePaste: X, onValueDrop: J, getUploadAudioData: me, getUploadAudioHeaders: de, onUploadAudioSuccess: ce, onUploadAudioBeforeUpload: pe, onUploadAudioRemove: fe, onUploadAudioError: ve, getUploadVideoData: ge, getUploadVideoHeaders: he, onUploadVideoSuccess: xe, onUploadVideoBeforeUpload: we, onUploadVideoRemove: be, onUploadVideoError: ye, ImgPond: Me };
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 };
646
540
  }
647
541
  });
648
542
  export {
649
- va as default
543
+ pa as default
650
544
  };
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.49",
5
+ "version": "0.0.12-alpha.50",
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.14"
26
+ "@keyblade/one-travel": "^2.0.15"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^2.7.0",