@keyblade/tinymce-editor-vue2 0.0.12-alpha.21 → 0.0.12-alpha.23

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 (3) hide show
  1. package/README.md +2 -11
  2. package/es/editor.vue2.js +127 -118
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -33,11 +33,6 @@ Vue.use(ImgPond, {})
33
33
  Vue.use(TinymceEditor, {
34
34
  imageUploadOptions: {
35
35
  handleRequest: (file: File | Blob, filename: string, parameters: { extParameters: Record<string, any> }) => {
36
- const form = new FormData()
37
- form.append('file', file, filename)
38
- postRequest('/api/man/uploadFile/uploadSingleFile', form).then((res) => {
39
- console.log(res)
40
- })
41
36
  return new Promise((resolve) => {
42
37
  setTimeout(() => {
43
38
  resolve({
@@ -61,7 +56,6 @@ Vue.use(TinymceEditor, {
61
56
  return {}
62
57
  },
63
58
  handlerResponse: (response: any) => {
64
- debugger
65
59
  return { url: response.data, errorMessage: response.msg }
66
60
  }
67
61
  },
@@ -75,9 +69,7 @@ Vue.use(TinymceEditor, {
75
69
  }
76
70
  },
77
71
  data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
78
- return {
79
- a: '1'
80
- }
72
+ return {}
81
73
  },
82
74
  handlerResponse: (response: any) => {
83
75
  return { url: response.data, errorMessage: response.msg }
@@ -142,6 +134,7 @@ interface ComponentOptions {
142
134
 
143
135
  /** 图片上传选项 */
144
136
  imageUploadOptions?: ImageUploadOptions;
137
+
145
138
  /** imgPond选项 */
146
139
  imgPondOptions?: Record<string, any>;
147
140
 
@@ -167,8 +160,6 @@ export interface ImageUploadOptions {
167
160
  maxSize?: number;
168
161
  /** 图片允许的后缀类型(小写,如: png、jpg) */
169
162
  allowedType?: string[];
170
- // /** 图片允许的类型(如: image/png、image/jpg) */
171
- // allowedMineType?: string[];
172
163
  /** 图片最小宽度 */
173
164
  minWidth?: number;
174
165
  /** 图片最小高度 */
package/es/editor.vue2.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineComponent as fe, ref as h, computed as w, watch as S, onMounted as ge, onUnmounted as he } from "vue";
2
- import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as xe, oneTravelImageCompressor as K } from "@keyblade/one-travel";
3
- import { getImagePixel as be, getFileExtension as ye } from "./util.js";
4
- import _e from "imgpond";
5
- import { conclude as A } from "vue-global-config";
6
- import Q from "tinymce";
7
- import we from "./langs/zh_CN.js";
1
+ import { defineComponent as ge, ref as h, computed as _, watch as S, onMounted as he, onUnmounted as xe } from "vue";
2
+ import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as be, oneTravelImageCompressor as K } from "@keyblade/one-travel";
3
+ import { getFileExtension as Q, getImagePixel as ye } from "./util.js";
4
+ import we from "imgpond";
5
+ import { conclude as C } from "vue-global-config";
6
+ import X from "tinymce";
7
+ import _e from "./langs/zh_CN.js";
8
8
  import "tinymce/skins/ui/oxide/skin";
9
9
  import "tinymce/models/dom";
10
10
  import "tinymce/themes/silver";
@@ -33,9 +33,9 @@ import "tinymce/plugins/table";
33
33
  import "tinymce/plugins/visualblocks";
34
34
  import "tinymce/plugins/visualchars";
35
35
  import "tinymce/plugins/wordcount";
36
- import { globalProps as C } from "./index.js";
36
+ import { globalProps as A } from "./index.js";
37
37
  import { Loading as k, Message as b } from "element-ui";
38
- const ra = /* @__PURE__ */ fe({
38
+ const ra = /* @__PURE__ */ ge({
39
39
  __name: "editor",
40
40
  props: {
41
41
  value: { default: "" },
@@ -49,9 +49,9 @@ const ra = /* @__PURE__ */ fe({
49
49
  initComplete: null
50
50
  },
51
51
  emits: ["input"],
52
- setup(X, { emit: z }) {
53
- const u = X;
54
- Q.addI18n("zh_CN", we);
52
+ setup(Y, { emit: z }) {
53
+ const m = Y;
54
+ X.addI18n("zh_CN", _e);
55
55
  const V = {
56
56
  maxCount: 10,
57
57
  tipText: "上传",
@@ -70,7 +70,7 @@ const ra = /* @__PURE__ */ fe({
70
70
  enable: !0,
71
71
  maxSize: 200,
72
72
  allowedType: ["mp3", "m4a", "wav", "aac"]
73
- }, R = h(), x = h(), P = h(!1), T = h(!1), c = w(() => A([u.imageUploadOptions, C.imageUploadOptions, V]) || {}), m = w(() => A([u.videoUploadOptions, C.videoUploadOptions, B]) || {}), f = w(() => A([u.audioUploadOptions, C.audioUploadOptions, H]) || {}), U = w(() => A([u.imgPondOptions, C.imgPondOptions]) || {}), Y = w(() => {
73
+ }, R = h(), x = h(), P = h(!1), T = h(!1), c = _(() => C([m.imageUploadOptions, A.imageUploadOptions, V]) || {}), d = _(() => C([m.videoUploadOptions, A.videoUploadOptions, B]) || {}), f = _(() => C([m.audioUploadOptions, A.audioUploadOptions, H]) || {}), U = _(() => C([m.imgPondOptions, A.imgPondOptions]) || {}), Z = _(() => {
74
74
  var e, o;
75
75
  return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
76
76
  }), D = h();
@@ -107,25 +107,25 @@ const ra = /* @__PURE__ */ fe({
107
107
  });
108
108
  }
109
109
  }, { immediate: !0 });
110
- const _ = h({
110
+ const w = h({
111
111
  dialogVisible: !1,
112
112
  formData: {
113
113
  images: []
114
114
  }
115
115
  }), W = h(), j = () => {
116
- _.value.dialogVisible = !1, _.value.formData = {
116
+ w.value.dialogVisible = !1, w.value.formData = {
117
117
  images: []
118
118
  };
119
- }, Z = () => {
119
+ }, ee = () => {
120
120
  var e;
121
121
  (e = W.value) == null || e.validate((o) => {
122
- o && (_.value.formData.images.forEach((i) => {
122
+ o && (w.value.formData.images.forEach((i) => {
123
123
  var t;
124
124
  let a = i;
125
125
  U.value.srcAt && (a = (i == null ? void 0 : i[U.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
126
126
  }), j());
127
127
  });
128
- }, p = h({
128
+ }, v = h({
129
129
  dialogVisible: !1,
130
130
  formData: {
131
131
  // 名称
@@ -137,17 +137,17 @@ const ra = /* @__PURE__ */ fe({
137
137
  },
138
138
  // 用于临时保存上传前的参数 { file: File }
139
139
  additionalData: {}
140
- }), $ = h(), I = () => {
141
- p.value.dialogVisible = !1, p.value.formData = {
140
+ }), $ = h(), E = () => {
141
+ v.value.dialogVisible = !1, v.value.formData = {
142
142
  name: "",
143
143
  cover: [],
144
144
  file: []
145
- }, p.value.additionalData = {};
146
- }, ee = () => {
145
+ }, v.value.additionalData = {};
146
+ }, ae = () => {
147
147
  var e;
148
148
  (e = $.value) == null || e.validate((o) => {
149
149
  var i, a;
150
- o && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${p.value.formData.name}" data-poster="${p.value.formData.cover[0]}" src="${(i = p.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), I());
150
+ o && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(i = v.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), E());
151
151
  });
152
152
  }, g = h({
153
153
  dialogVisible: !1,
@@ -157,18 +157,18 @@ const ra = /* @__PURE__ */ fe({
157
157
  },
158
158
  // 用于临时保存上传前的参数 { file: File }
159
159
  additionalData: {}
160
- }), E = h(), q = () => {
160
+ }), I = h(), q = () => {
161
161
  g.value.dialogVisible = !1, g.value.formData = {
162
162
  file: []
163
163
  }, g.value.additionalData = {};
164
- }, ae = () => {
164
+ }, te = () => {
165
165
  var e;
166
- (e = E.value) == null || e.validate((o) => {
166
+ (e = I.value) == null || e.validate((o) => {
167
167
  var i, a;
168
168
  o && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(i = g.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), q());
169
169
  });
170
- }, te = (e, o) => new Promise(async (i, a) => {
171
- var l, r;
170
+ }, oe = (e, o) => new Promise(async (i, a) => {
171
+ var r, l;
172
172
  const t = await K(e);
173
173
  if (!t.success) {
174
174
  a(), setTimeout(() => {
@@ -176,7 +176,7 @@ const ra = /* @__PURE__ */ fe({
176
176
  });
177
177
  return;
178
178
  }
179
- const n = await ((r = (l = c.value).handleRequest) == null ? void 0 : r.call(l, t.file, e.name, { extParameters: u.extParameters }));
179
+ const n = await ((l = (r = c.value).handleRequest) == null ? void 0 : l.call(r, t.file, e.name, { extParameters: m.extParameters }));
180
180
  if (!n || !(n != null && n.success)) {
181
181
  a(), setTimeout(() => {
182
182
  o.onError(n == null ? void 0 : n.errorMessage);
@@ -186,25 +186,27 @@ const ra = /* @__PURE__ */ fe({
186
186
  i(n.url);
187
187
  });
188
188
  async function F(e) {
189
- var i, a, t, n;
189
+ var i, a, t, n, r;
190
190
  const o = e.getElementsByTagName("img");
191
191
  for (let l of o) {
192
- const r = l.src;
193
- if (r.startsWith("http://") || r.startsWith("https://")) {
194
- const s = await be(r);
195
- if (s && (s.width < (c.value.minWidth || 0) && s.height < (c.value.minHeight || 0) || s.width > (c.value.maxWidth || 0) && s.height > (c.value.maxHeight || 0))) {
196
- (i = l == null ? void 0 : l.remove) == null || i.call(l);
192
+ const s = l.src;
193
+ if (s.startsWith("data:image"))
194
+ (i = l == null ? void 0 : l.remove) == null || i.call(l);
195
+ else if (s.startsWith("http://") || s.startsWith("https://")) {
196
+ const u = await ye(s);
197
+ if (u && (u.width < (c.value.minWidth || 0) && u.height < (c.value.minHeight || 0) || u.width > (c.value.maxWidth || 0) && u.height > (c.value.maxHeight || 0))) {
198
+ (a = l == null ? void 0 : l.remove) == null || a.call(l);
197
199
  return;
198
200
  }
199
- const d = ye(r);
200
- if (!((t = (a = c.value) == null ? void 0 : a.allowedType) != null && t.includes(d.toLowerCase()))) {
201
- (n = l == null ? void 0 : l.remove) == null || n.call(l);
201
+ const p = Q(s);
202
+ if (!((n = (t = c.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
203
+ (r = l == null ? void 0 : l.remove) == null || r.call(l);
202
204
  return;
203
205
  }
204
206
  }
205
207
  }
206
208
  }
207
- ge(() => {
209
+ he(() => {
208
210
  var i;
209
211
  const e = {
210
212
  // 设置语言
@@ -296,14 +298,14 @@ const ra = /* @__PURE__ */ fe({
296
298
  },
297
299
  images_upload_handler(a) {
298
300
  return new Promise(async (t, n) => {
299
- var N, O, G;
301
+ var N, O, L;
300
302
  if (!((N = c.value) != null && N.handleRequest))
301
303
  return n({ message: "缺少图片上传配置", remove: !0 });
302
- const l = k.service({ text: "上传中" });
303
- let r = a.blob(), s = r.name ? r.name : a.filename();
304
- if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
305
- return l == null || l.close(), n({ message: "不允许粘贴", remove: !0 });
306
- const d = await xe(r, s, {
304
+ const r = k.service({ text: "上传中" });
305
+ let l = a.blob(), s = l.name ? l.name : a.filename();
306
+ if (!(l != null && l.name) && !(l != null && l.lastModified) && l.type === "image/png")
307
+ return r == null || r.close(), n({ message: "不允许粘贴", remove: !0 });
308
+ const u = await be(l, s, {
307
309
  imageMaxSize: c.value.maxSize,
308
310
  imageAllowedType: c.value.allowedType,
309
311
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
@@ -312,29 +314,29 @@ const ra = /* @__PURE__ */ fe({
312
314
  imageMaxWidth: c.value.maxWidth,
313
315
  imageMaxHeight: c.value.maxHeight
314
316
  });
315
- if (!d.success)
316
- return l == null || l.close(), n({ message: (d == null ? void 0 : d.errorMessage) || "", remove: !0 });
317
- if (d.hasTransform) {
318
- r = d.file;
319
- const L = s == null ? void 0 : s.split(".");
320
- L.pop(), s = `${L.join(",")}.jpeg`;
317
+ if (!u.success)
318
+ return r == null || r.close(), n({ message: (u == null ? void 0 : u.errorMessage) || "", remove: !0 });
319
+ if (u.hasTransform) {
320
+ l = u.file;
321
+ const G = s == null ? void 0 : s.split(".");
322
+ G.pop(), s = `${G.join(",")}.jpeg`;
321
323
  }
322
- const v = await K(r);
323
- if (!v.success)
324
- return l == null || l.close(), n({ message: v == null ? void 0 : v.errorMessage, remove: !0 });
325
- const y = await ((G = (O = c.value).handleRequest) == null ? void 0 : G.call(O, v.file, s, { extParameters: u.extParameters }));
324
+ const p = await K(l);
325
+ if (!p.success)
326
+ return r == null || r.close(), n({ message: p == null ? void 0 : p.errorMessage, remove: !0 });
327
+ const y = await ((L = (O = c.value).handleRequest) == null ? void 0 : L.call(O, p.file, s, { extParameters: m.extParameters }));
326
328
  if (!y || !y.success)
327
- return l == null || l.close(), n({ message: y.errorMessage, remove: !0 });
328
- l == null || l.close(), t(y.url);
329
+ return r == null || r.close(), n({ message: y.errorMessage, remove: !0 });
330
+ r == null || r.close(), t(y.url);
329
331
  });
330
332
  },
331
333
  setup(a) {
332
- var n, l;
334
+ var n, r;
333
335
  const t = () => {
334
- _.value.dialogVisible = !0, setTimeout(() => {
335
- var s, d;
336
- const r = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
337
- r && (r.innerHTML = ((d = c.value) == null ? void 0 : d.tipText) || "上传");
336
+ w.value.dialogVisible = !0, setTimeout(() => {
337
+ var s, u;
338
+ const l = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
339
+ l && (l.innerHTML = ((u = c.value) == null ? void 0 : u.tipText) || "上传");
338
340
  });
339
341
  };
340
342
  if (a.ui.registry.addMenuItem("localImage", {
@@ -346,42 +348,42 @@ const ra = /* @__PURE__ */ fe({
346
348
  tooltip: "图片",
347
349
  onAction: () => t()
348
350
  }), (n = f == null ? void 0 : f.value) != null && n.enable) {
349
- const r = () => {
350
- p.value.dialogVisible = !0, setTimeout(() => {
351
- var d, v;
352
- const s = (d = document == null ? void 0 : document.querySelector) == null ? void 0 : d.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
353
- s && (s.innerHTML = ((v = c.value) == null ? void 0 : v.tipText) || "上传");
351
+ const l = () => {
352
+ v.value.dialogVisible = !0, setTimeout(() => {
353
+ var u, p;
354
+ const s = (u = document == null ? void 0 : document.querySelector) == null ? void 0 : u.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
355
+ s && (s.innerHTML = ((p = c.value) == null ? void 0 : p.tipText) || "上传");
354
356
  });
355
357
  };
356
358
  a.ui.registry.addMenuItem("localAudio", {
357
359
  text: "音频",
358
360
  icon: "arrow-right",
359
- onAction: () => r()
361
+ onAction: () => l()
360
362
  }), a.ui.registry.addButton("localAudio", {
361
363
  icon: "arrow-right",
362
364
  tooltip: "音频",
363
- onAction: () => r()
365
+ onAction: () => l()
364
366
  });
365
367
  }
366
- if ((l = m == null ? void 0 : m.value) != null && l.enable) {
367
- const r = () => {
368
+ if ((r = d == null ? void 0 : d.value) != null && r.enable) {
369
+ const l = () => {
368
370
  g.value.dialogVisible = !0;
369
371
  };
370
372
  a.ui.registry.addMenuItem("localVideo", {
371
373
  text: "视频",
372
374
  icon: "embed",
373
- onAction: () => r()
375
+ onAction: () => l()
374
376
  }), a.ui.registry.addButton("localVideo", {
375
377
  icon: "embed",
376
378
  tooltip: "视频",
377
- onAction: () => r()
379
+ onAction: () => l()
378
380
  });
379
381
  }
380
382
  }
381
- }, o = A(
383
+ }, o = C(
382
384
  [
383
- u.options,
384
- C.options,
385
+ m.options,
386
+ A.options,
385
387
  e
386
388
  ],
387
389
  {
@@ -391,92 +393,99 @@ const ra = /* @__PURE__ */ fe({
391
393
  type: Object
392
394
  }
393
395
  );
394
- Q.init(o).then(([a]) => {
396
+ X.init(o).then(([a]) => {
395
397
  var t;
396
- a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
398
+ a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
397
399
  if (T.value) {
398
400
  T.value = !1;
399
401
  return;
400
402
  }
401
403
  P.value = !0, z("input", a.getContent());
402
- }), (t = u.initComplete) == null || t.call(u, { editorIns: a }), x.value = a);
404
+ }), a.on("paste", (n) => {
405
+ var l, s;
406
+ const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
407
+ for (let u of r) {
408
+ const p = Q(u.name) || "";
409
+ (s = c.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
410
+ }
411
+ }), (t = m.initComplete) == null || t.call(m, { editorIns: a }), x.value = a);
403
412
  });
404
- }), he(() => {
413
+ }), xe(() => {
405
414
  var e;
406
415
  (e = x.value) == null || e.destroy();
407
416
  });
408
- const oe = () => {
417
+ const ie = () => {
409
418
  var o, i;
410
- const e = { ...p.value.additionalData || {} };
411
- return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
412
- }, ie = () => {
419
+ const e = { ...v.value.additionalData || {} };
420
+ return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
421
+ }, le = () => {
413
422
  var o, i;
414
- const e = { ...p.value.additionalData || {} };
415
- return ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
416
- }, le = (e, o, i) => {
423
+ const e = { ...v.value.additionalData || {} };
424
+ return ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
425
+ }, ne = (e, o, i) => {
417
426
  var t, n;
418
427
  const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
419
- a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), p.value.formData.file = i;
420
- }, ne = (e, o) => new Promise((i, a) => {
421
- var n, l, r, s, d, v;
428
+ a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), v.value.formData.file = i;
429
+ }, re = (e, o) => new Promise((i, a) => {
430
+ var n, r, l, s, u, p;
422
431
  const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
423
- if (!((l = (n = f.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
424
- b.error(`请上传格式为${(s = (r = f.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
432
+ if (!((r = (n = f.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
433
+ b.error(`请上传格式为${(s = (l = f.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
425
434
  return;
426
435
  }
427
- if (e.size > (((d = f.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
428
- b.error(`请上传${((v = f.value) == null ? void 0 : v.maxSize) || 0}M内的音频`), a();
436
+ if (e.size > (((u = f.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
437
+ b.error(`请上传${((p = f.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
429
438
  return;
430
439
  }
431
- p.value.additionalData = { file: e }, i(!0);
432
- }), re = (e, o) => {
433
- p.value.formData.file = o;
434
- }, se = (e, o, i) => {
435
- b.error("上传发生错误,请重试!"), p.value.formData.file = i;
436
- }, ue = () => {
440
+ v.value.additionalData = { file: e }, i(!0);
441
+ }), se = (e, o) => {
442
+ v.value.formData.file = o;
443
+ }, ue = (e, o, i) => {
444
+ b.error("上传发生错误,请重试!"), v.value.formData.file = i;
445
+ }, ce = () => {
437
446
  var o, i;
438
447
  const e = { ...g.value.additionalData || {} };
439
- return ((i = (o = m.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
440
- }, ce = () => {
448
+ return ((i = (o = d.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
449
+ }, me = () => {
441
450
  var o, i;
442
451
  const e = { ...g.value.additionalData || {} };
443
- return ((i = (o = m.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
444
- }, me = (e, o, i) => {
452
+ return ((i = (o = d.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
453
+ }, de = (e, o, i) => {
445
454
  var t, n;
446
- const a = (n = (t = m == null ? void 0 : m.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
455
+ const a = (n = (t = d == null ? void 0 : d.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
447
456
  a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), g.value.formData.file = i;
448
- }, de = (e, o) => new Promise((i, a) => {
449
- var n, l, r, s, d, v;
457
+ }, pe = (e, o) => new Promise((i, a) => {
458
+ var n, r, l, s, u, p;
450
459
  const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
451
- if (!((l = (n = m == null ? void 0 : m.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
452
- b.error(`请上传格式为${(s = (r = m == null ? void 0 : m.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
460
+ if (!((r = (n = d == null ? void 0 : d.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
461
+ b.error(`请上传格式为${(s = (l = d == null ? void 0 : d.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
453
462
  return;
454
463
  }
455
- if (e.size > (((d = m == null ? void 0 : m.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
456
- b.error(`请上传${((v = m == null ? void 0 : m.value) == null ? void 0 : v.maxSize) || 0}M内的视频`), a();
464
+ if (e.size > (((u = d == null ? void 0 : d.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
465
+ b.error(`请上传${((p = d == null ? void 0 : d.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
457
466
  return;
458
467
  }
459
468
  g.value.additionalData = { file: e }, i(!0);
460
- }), pe = (e, o) => {
469
+ }), ve = (e, o) => {
461
470
  g.value.formData.file = o;
462
- }, ve = (e, o, i) => {
471
+ }, fe = (e, o, i) => {
463
472
  b.error("上传发生错误,请重试!"), g.value.formData.file = i;
464
473
  };
465
- return S(() => [u.disabled, x.value], () => {
474
+ return S(() => [m.disabled, x.value], () => {
466
475
  var e, o;
467
- (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(u.disabled ? "readonly" : "design");
476
+ (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(m.disabled ? "readonly" : "design");
468
477
  }, { immediate: !0 }), S(
469
- () => [u.value, x.value],
478
+ () => [m.value, x.value],
470
479
  () => {
471
480
  var e;
472
481
  if (P.value) {
473
482
  P.value = !1;
474
483
  return;
475
484
  }
476
- T.value = !0, (e = x.value) == null || e.setContent(u.value ? u.value : "");
485
+ T.value = !0, (e = x.value) == null || e.setContent(m.value ? m.value : "");
477
486
  },
478
487
  { immediate: !0 }
479
- ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef: x, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: c, mergeVideoUploadOptions: m, mergeAudioUploadOptions: f, mergeImgPondOptions: U, imgPondAccept: Y, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: _, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: Z, uploadAudio: p, uploadAudioFormRef: $, onUploadAudioClose: I, onUploadAudioConfirm: ee, uploadVideo: g, uploadVideoFormRef: E, onUploadVideoClose: q, onUploadVideoConfirm: ae, onImageUploadUpload: te, processPastedImage: F, getUploadAudioData: oe, getUploadAudioHeaders: ie, onUploadAudioSuccess: le, onUploadAudioBeforeUpload: ne, onUploadAudioRemove: re, onUploadAudioError: se, getUploadVideoData: ue, getUploadVideoHeaders: ce, onUploadVideoSuccess: me, onUploadVideoBeforeUpload: de, onUploadVideoRemove: pe, onUploadVideoError: ve, ImgPond: _e };
488
+ ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: m, emits: z, insRef: R, editorRef: x, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: c, mergeVideoUploadOptions: d, mergeAudioUploadOptions: f, mergeImgPondOptions: U, imgPondAccept: Z, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: w, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: ee, uploadAudio: v, uploadAudioFormRef: $, onUploadAudioClose: E, onUploadAudioConfirm: ae, uploadVideo: g, uploadVideoFormRef: I, onUploadVideoClose: q, onUploadVideoConfirm: te, onImageUploadUpload: oe, processPastedImage: F, getUploadAudioData: ie, getUploadAudioHeaders: le, onUploadAudioSuccess: ne, onUploadAudioBeforeUpload: re, onUploadAudioRemove: se, onUploadAudioError: ue, getUploadVideoData: ce, getUploadVideoHeaders: me, onUploadVideoSuccess: de, onUploadVideoBeforeUpload: pe, onUploadVideoRemove: ve, onUploadVideoError: fe, ImgPond: we };
480
489
  }
481
490
  });
482
491
  export {
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.21",
5
+ "version": "0.0.12-alpha.23",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",