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

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 +191 -184
  2. package/package.json +1 -1
package/es/editor.vue2.js CHANGED
@@ -1,10 +1,10 @@
1
- import { defineComponent as ve, ref as g, computed as w, watch as S, onMounted as fe, onUnmounted as ge } from "vue";
2
- import { oneTravelImgPondBeforeAddFile as L, oneTravelImageCheckAndTransform as he, oneTravelImageCompressor as J } from "@keyblade/one-travel";
3
- import { getImagePixel as xe, getFileExtension as be } from "./util.js";
4
- import ye from "imgpond";
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
5
  import { conclude as A } from "vue-global-config";
6
- import K from "tinymce";
7
- import _e from "./langs/zh_CN.js";
6
+ import Q from "tinymce";
7
+ import we 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";
@@ -35,7 +35,7 @@ import "tinymce/plugins/visualchars";
35
35
  import "tinymce/plugins/wordcount";
36
36
  import { globalProps as C } from "./index.js";
37
37
  import { Loading as k, Message as b } from "element-ui";
38
- const na = /* @__PURE__ */ ve({
38
+ const ra = /* @__PURE__ */ fe({
39
39
  __name: "editor",
40
40
  props: {
41
41
  value: { default: "" },
@@ -49,9 +49,9 @@ const na = /* @__PURE__ */ ve({
49
49
  initComplete: null
50
50
  },
51
51
  emits: ["input"],
52
- setup(Q, { emit: z }) {
53
- const u = Q;
54
- K.addI18n("zh_CN", _e);
52
+ setup(X, { emit: z }) {
53
+ const u = X;
54
+ Q.addI18n("zh_CN", we);
55
55
  const V = {
56
56
  maxCount: 10,
57
57
  tipText: "上传",
@@ -70,62 +70,62 @@ const na = /* @__PURE__ */ ve({
70
70
  enable: !0,
71
71
  maxSize: 200,
72
72
  allowedType: ["mp3", "m4a", "wav", "aac"]
73
- }, R = g(), h = g(), P = g(!1), T = g(!1), m = w(() => A([u.imageUploadOptions, C.imageUploadOptions, V]) || {}), c = w(() => A([u.videoUploadOptions, C.videoUploadOptions, B]) || {}), v = w(() => A([u.audioUploadOptions, C.audioUploadOptions, H]) || {}), U = w(() => A([u.imgPondOptions, C.imgPondOptions]) || {}), X = w(() => {
74
- var t, o;
75
- return ((o = (t = m == null ? void 0 : m.value) == null ? void 0 : t.allowedType) == null ? void 0 : o.map((a) => `.${a}`).join(",")) || "";
76
- }), D = g();
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(() => {
74
+ var e, o;
75
+ return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
76
+ }), D = h();
77
77
  S(() => D.value, () => {
78
78
  if (D.value) {
79
- let t;
80
- L(D.value, {
79
+ let e;
80
+ J(D.value, {
81
81
  onStart: () => {
82
- t = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
82
+ e = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
83
83
  },
84
84
  onSuccess: () => {
85
- t == null || t.close();
85
+ e == null || e.close();
86
86
  },
87
87
  onError: (o) => {
88
- t == null || t.close(), b.error(o);
88
+ e == null || e.close(), b.error(o);
89
89
  }
90
90
  });
91
91
  }
92
92
  }, { immediate: !0 });
93
- const M = g();
93
+ const M = h();
94
94
  S(() => M.value, () => {
95
95
  if (M.value) {
96
- let t;
97
- L(M.value, {
96
+ let e;
97
+ J(M.value, {
98
98
  onStart: () => {
99
- t = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
99
+ e = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
100
100
  },
101
101
  onSuccess: () => {
102
- t == null || t.close();
102
+ e == null || e.close();
103
103
  },
104
104
  onError: (o) => {
105
- t == null || t.close(), b.error(o);
105
+ e == null || e.close(), b.error(o);
106
106
  }
107
107
  });
108
108
  }
109
109
  }, { immediate: !0 });
110
- const _ = g({
110
+ const _ = h({
111
111
  dialogVisible: !1,
112
112
  formData: {
113
113
  images: []
114
114
  }
115
- }), I = g(), W = () => {
115
+ }), W = h(), j = () => {
116
116
  _.value.dialogVisible = !1, _.value.formData = {
117
117
  images: []
118
118
  };
119
- }, Y = () => {
120
- var t;
121
- (t = I.value) == null || t.validate((o) => {
122
- o && (_.value.formData.images.forEach((a) => {
123
- var l;
124
- let e = a;
125
- U.value.srcAt && (e = (a == null ? void 0 : a[U.value.srcAt]) || ""), (l = h.value) == null || l.insertContent(`<img src=${e} alt="" />`);
126
- }), W());
119
+ }, Z = () => {
120
+ var e;
121
+ (e = W.value) == null || e.validate((o) => {
122
+ o && (_.value.formData.images.forEach((i) => {
123
+ var t;
124
+ let a = i;
125
+ U.value.srcAt && (a = (i == null ? void 0 : i[U.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
126
+ }), j());
127
127
  });
128
- }, p = g({
128
+ }, p = h({
129
129
  dialogVisible: !1,
130
130
  formData: {
131
131
  // 名称
@@ -137,19 +137,19 @@ const na = /* @__PURE__ */ ve({
137
137
  },
138
138
  // 用于临时保存上传前的参数 { file: File }
139
139
  additionalData: {}
140
- }), $ = g(), E = () => {
140
+ }), $ = h(), I = () => {
141
141
  p.value.dialogVisible = !1, p.value.formData = {
142
142
  name: "",
143
143
  cover: [],
144
144
  file: []
145
145
  }, p.value.additionalData = {};
146
- }, Z = () => {
147
- var t;
148
- (t = $.value) == null || t.validate((o) => {
149
- var a, e;
150
- o && ((e = h.value) == null || e.insertContent(`<audio controls data-name="${p.value.formData.name}" data-poster="${p.value.formData.cover[0]}" src="${(a = p.value.formData.file[0]) == null ? void 0 : a.url}"></audio>`), E());
146
+ }, ee = () => {
147
+ var e;
148
+ (e = $.value) == null || e.validate((o) => {
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());
151
151
  });
152
- }, f = g({
152
+ }, g = h({
153
153
  dialogVisible: !1,
154
154
  formData: {
155
155
  // 文件
@@ -157,55 +157,56 @@ const na = /* @__PURE__ */ ve({
157
157
  },
158
158
  // 用于临时保存上传前的参数 { file: File }
159
159
  additionalData: {}
160
- }), q = g(), F = () => {
161
- f.value.dialogVisible = !1, f.value.formData = {
160
+ }), E = h(), q = () => {
161
+ g.value.dialogVisible = !1, g.value.formData = {
162
162
  file: []
163
- }, f.value.additionalData = {};
164
- }, ee = () => {
165
- var t;
166
- (t = q.value) == null || t.validate((o) => {
167
- var a, e;
168
- o && ((e = h.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(a = f.value.formData.file[0]) == null ? void 0 : a.url}"></video>`), F());
163
+ }, g.value.additionalData = {};
164
+ }, ae = () => {
165
+ var e;
166
+ (e = E.value) == null || e.validate((o) => {
167
+ var i, a;
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
- }, ae = (t, o) => new Promise(async (a, e) => {
171
- var n, r;
172
- const l = await J(t);
173
- if (!l.success) {
174
- e(), setTimeout(() => {
175
- o.onError(l.errorMessage);
170
+ }, te = (e, o) => new Promise(async (i, a) => {
171
+ var l, r;
172
+ const t = await K(e);
173
+ if (!t.success) {
174
+ a(), setTimeout(() => {
175
+ o.onError(t.errorMessage);
176
176
  });
177
177
  return;
178
178
  }
179
- const i = await ((r = (n = m.value).handleRequest) == null ? void 0 : r.call(n, l.file, t.name, { extParameters: u.extParameters }));
180
- if (!i || !(i != null && i.success)) {
181
- e(), setTimeout(() => {
182
- o.onError(i == null ? void 0 : i.errorMessage);
179
+ const n = await ((r = (l = c.value).handleRequest) == null ? void 0 : r.call(l, t.file, e.name, { extParameters: u.extParameters }));
180
+ if (!n || !(n != null && n.success)) {
181
+ a(), setTimeout(() => {
182
+ o.onError(n == null ? void 0 : n.errorMessage);
183
183
  });
184
184
  return;
185
185
  }
186
- a(i.url);
186
+ i(n.url);
187
187
  });
188
- async function N(t) {
189
- var a, e, l, i;
190
- const o = t.getElementsByTagName("img");
191
- for (let n of o) {
192
- const r = n.src;
188
+ async function F(e) {
189
+ var i, a, t, n;
190
+ const o = e.getElementsByTagName("img");
191
+ for (let l of o) {
192
+ const r = l.src;
193
193
  if (r.startsWith("http://") || r.startsWith("https://")) {
194
- const s = await xe(r);
195
- if (s && (s.width < (m.value.minWidth || 0) && s.height < (m.value.minHeight || 0) || s.width > (m.value.maxWidth || 0) && s.height > (m.value.maxHeight || 0))) {
196
- (a = n == null ? void 0 : n.remove) == null || a.call(n);
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);
197
197
  return;
198
198
  }
199
- const d = be(r);
200
- if (!((l = (e = m.value) == null ? void 0 : e.allowedType) != null && l.includes(d.toLowerCase()))) {
201
- (i = n == null ? void 0 : n.remove) == null || i.call(n);
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);
202
202
  return;
203
203
  }
204
204
  }
205
205
  }
206
206
  }
207
- fe(() => {
208
- const t = {
207
+ ge(() => {
208
+ var i;
209
+ const e = {
209
210
  // 设置语言
210
211
  language: "zh_CN",
211
212
  // 实例
@@ -284,90 +285,96 @@ const na = /* @__PURE__ */ ve({
284
285
  convert_urls: !1,
285
286
  paste_webkit_styles: "all",
286
287
  paste_data_images: !0,
288
+ images_file_types: ((i = c.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
287
289
  // 粘贴前处理
288
- paste_preprocess(a, e) {
289
- e.content = e.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), e.content = e.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), e.content = e.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), e.content = e.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), e.content = e.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), e.content = e.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), e.content = e.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), e.content = e.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), e.content = e.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), e.content = e.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
290
+ paste_preprocess(a, t) {
291
+ t.content = t.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), t.content = t.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), t.content = t.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), t.content = t.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), t.content = t.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), t.content = t.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), t.content = t.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), t.content = t.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), t.content = t.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), t.content = t.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
290
292
  },
291
293
  // 粘贴后处理(处理异步操作)
292
- paste_postprocess(a, e) {
293
- N(e.node);
294
+ paste_postprocess(a, t) {
295
+ F(t.node);
294
296
  },
295
297
  images_upload_handler(a) {
296
- return new Promise(async (e, l) => {
297
- var y, j, O;
298
- if (!((y = m.value) != null && y.handleRequest))
299
- return l({ message: "缺少图片上传配置", remove: !0 });
300
- const i = k.service({ text: "上传中" });
301
- let n = a.blob(), r = a.filename();
302
- const s = await he(n, r, {
303
- imageMaxSize: m.value.maxSize,
304
- imageAllowedType: m.value.allowedType,
298
+ return new Promise(async (t, n) => {
299
+ var N, O, G;
300
+ if (!((N = c.value) != null && N.handleRequest))
301
+ 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, {
307
+ imageMaxSize: c.value.maxSize,
308
+ imageAllowedType: c.value.allowedType,
305
309
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
306
- imageMinWidth: m.value.minWidth,
307
- imageMinHeight: m.value.minHeight,
308
- imageMaxWidth: m.value.maxWidth,
309
- imageMaxHeight: m.value.maxHeight
310
+ imageMinWidth: c.value.minWidth,
311
+ imageMinHeight: c.value.minHeight,
312
+ imageMaxWidth: c.value.maxWidth,
313
+ imageMaxHeight: c.value.maxHeight
310
314
  });
311
- if (s.success || (i == null || i.close(), l({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 })), s.hasTransform) {
312
- const G = r == null ? void 0 : r.split(".");
313
- G.pop(), r = `${G.join(",")}.jpeg`;
314
- }
315
- const d = await J(n);
316
315
  if (!d.success)
317
- return i == null || i.close(), l({ message: d == null ? void 0 : d.errorMessage, remove: !0 });
318
- const x = await ((O = (j = m.value).handleRequest) == null ? void 0 : O.call(j, d.file, r, { extParameters: u.extParameters }));
319
- if (!x || !x.success)
320
- return i == null || i.close(), l({ message: x.errorMessage, remove: !0 });
321
- i == null || i.close(), e(x.url);
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`;
321
+ }
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 }));
326
+ if (!y || !y.success)
327
+ return l == null || l.close(), n({ message: y.errorMessage, remove: !0 });
328
+ l == null || l.close(), t(y.url);
322
329
  });
323
330
  },
324
331
  setup(a) {
325
- var l, i;
326
- const e = () => {
332
+ var n, l;
333
+ const t = () => {
327
334
  _.value.dialogVisible = !0, setTimeout(() => {
328
- var r, s;
329
- const n = (r = document == null ? void 0 : document.querySelector) == null ? void 0 : r.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
330
- n && (n.innerHTML = ((s = m.value) == null ? void 0 : s.tipText) || "上传");
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) || "上传");
331
338
  });
332
339
  };
333
340
  if (a.ui.registry.addMenuItem("localImage", {
334
341
  text: "图片",
335
342
  icon: "image",
336
- onAction: () => e()
343
+ onAction: () => t()
337
344
  }), a.ui.registry.addButton("localImage", {
338
345
  icon: "image",
339
346
  tooltip: "图片",
340
- onAction: () => e()
341
- }), (l = v == null ? void 0 : v.value) != null && l.enable) {
342
- const n = () => {
347
+ onAction: () => t()
348
+ }), (n = f == null ? void 0 : f.value) != null && n.enable) {
349
+ const r = () => {
343
350
  p.value.dialogVisible = !0, setTimeout(() => {
344
- var s, d;
345
- const r = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
346
- r && (r.innerHTML = ((d = m.value) == null ? void 0 : d.tipText) || "上传");
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) || "上传");
347
354
  });
348
355
  };
349
356
  a.ui.registry.addMenuItem("localAudio", {
350
357
  text: "音频",
351
358
  icon: "arrow-right",
352
- onAction: () => n()
359
+ onAction: () => r()
353
360
  }), a.ui.registry.addButton("localAudio", {
354
361
  icon: "arrow-right",
355
362
  tooltip: "音频",
356
- onAction: () => n()
363
+ onAction: () => r()
357
364
  });
358
365
  }
359
- if ((i = c == null ? void 0 : c.value) != null && i.enable) {
360
- const n = () => {
361
- f.value.dialogVisible = !0;
366
+ if ((l = m == null ? void 0 : m.value) != null && l.enable) {
367
+ const r = () => {
368
+ g.value.dialogVisible = !0;
362
369
  };
363
370
  a.ui.registry.addMenuItem("localVideo", {
364
371
  text: "视频",
365
372
  icon: "embed",
366
- onAction: () => n()
373
+ onAction: () => r()
367
374
  }), a.ui.registry.addButton("localVideo", {
368
375
  icon: "embed",
369
376
  tooltip: "视频",
370
- onAction: () => n()
377
+ onAction: () => r()
371
378
  });
372
379
  }
373
380
  }
@@ -375,103 +382,103 @@ const na = /* @__PURE__ */ ve({
375
382
  [
376
383
  u.options,
377
384
  C.options,
378
- t
385
+ e
379
386
  ],
380
387
  {
381
- mergeFunction: (a, e) => (...l) => {
382
- a(...l), e(...l);
388
+ mergeFunction: (a, t) => (...n) => {
389
+ a(...n), t(...n);
383
390
  },
384
391
  type: Object
385
392
  }
386
393
  );
387
- K.init(o).then(([a]) => {
388
- var e;
394
+ Q.init(o).then(([a]) => {
395
+ var t;
389
396
  a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
390
397
  if (T.value) {
391
398
  T.value = !1;
392
399
  return;
393
400
  }
394
401
  P.value = !0, z("input", a.getContent());
395
- }), (e = u.initComplete) == null || e.call(u, { editorIns: a }), h.value = a);
402
+ }), (t = u.initComplete) == null || t.call(u, { editorIns: a }), x.value = a);
396
403
  });
397
- }), ge(() => {
398
- var t;
399
- (t = h.value) == null || t.destroy();
404
+ }), he(() => {
405
+ var e;
406
+ (e = x.value) == null || e.destroy();
400
407
  });
401
- const te = () => {
402
- var o, a;
403
- const t = { ...p.value.additionalData || {} };
404
- return ((a = (o = v.value) == null ? void 0 : o.data) == null ? void 0 : a.call(o, { file: t, extParameters: u.extParameters })) || {};
405
- }, oe = () => {
406
- var o, a;
407
- const t = { ...p.value.additionalData || {} };
408
- return ((a = (o = v.value) == null ? void 0 : o.headers) == null ? void 0 : a.call(o, { file: t, extParameters: u.extParameters })) || {};
409
- }, ie = (t, o, a) => {
410
- var l, i;
411
- const e = (i = (l = v == null ? void 0 : v.value) == null ? void 0 : l.handlerResponse) == null ? void 0 : i.call(l, t);
412
- e != null && e.url ? a[a.length - 1].url = e.url : e != null && e.errorMessage && (b.error(e.errorMessage), a.splice(a.length - 1, 1)), p.value.formData.file = a;
413
- }, le = (t, o) => new Promise((a, e) => {
414
- var i, n, r, s, d, x;
415
- const l = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
416
- if (!((n = (i = v.value) == null ? void 0 : i.allowedType) != null && n.includes(l.toLowerCase()))) {
417
- b.error(`请上传格式为${(s = (r = v.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), e();
408
+ const oe = () => {
409
+ 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 = () => {
413
+ 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) => {
417
+ var t, n;
418
+ 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;
422
+ 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();
418
425
  return;
419
426
  }
420
- if (t.size > (((d = v.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
421
- b.error(`请上传${((x = v.value) == null ? void 0 : x.maxSize) || 0}M内的音频`), e();
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();
422
429
  return;
423
430
  }
424
- p.value.additionalData = { file: t }, a(!0);
425
- }), ne = (t, o) => {
431
+ p.value.additionalData = { file: e }, i(!0);
432
+ }), re = (e, o) => {
426
433
  p.value.formData.file = o;
427
- }, re = (t, o, a) => {
428
- b.error("上传发生错误,请重试!"), p.value.formData.file = a;
429
- }, se = () => {
430
- var o, a;
431
- const t = { ...f.value.additionalData || {} };
432
- return ((a = (o = c.value) == null ? void 0 : o.data) == null ? void 0 : a.call(o, { file: t, extParameters: u.extParameters })) || {};
434
+ }, se = (e, o, i) => {
435
+ b.error("上传发生错误,请重试!"), p.value.formData.file = i;
433
436
  }, ue = () => {
434
- var o, a;
435
- const t = { ...f.value.additionalData || {} };
436
- return ((a = (o = c.value) == null ? void 0 : o.headers) == null ? void 0 : a.call(o, { file: t, extParameters: u.extParameters })) || {};
437
- }, ce = (t, o, a) => {
438
- var l, i;
439
- const e = (i = (l = c == null ? void 0 : c.value) == null ? void 0 : l.handlerResponse) == null ? void 0 : i.call(l, t);
440
- e != null && e.url ? a[a.length - 1].url = e.url : e != null && e.errorMessage && (b.error(e.errorMessage), a.splice(a.length - 1, 1)), f.value.formData.file = a;
441
- }, me = (t, o) => new Promise((a, e) => {
442
- var i, n, r, s, d, x;
443
- const l = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
444
- if (!((n = (i = c == null ? void 0 : c.value) == null ? void 0 : i.allowedType) != null && n.includes(l.toLowerCase()))) {
445
- b.error(`请上传格式为${(s = (r = c == null ? void 0 : c.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), e();
437
+ var o, i;
438
+ 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 = () => {
441
+ var o, i;
442
+ 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) => {
445
+ 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);
447
+ 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;
450
+ 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();
446
453
  return;
447
454
  }
448
- if (t.size > (((d = c == null ? void 0 : c.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
449
- b.error(`请上传${((x = c == null ? void 0 : c.value) == null ? void 0 : x.maxSize) || 0}M内的视频`), e();
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();
450
457
  return;
451
458
  }
452
- f.value.additionalData = { file: t }, a(!0);
453
- }), de = (t, o) => {
454
- f.value.formData.file = o;
455
- }, pe = (t, o, a) => {
456
- b.error("上传发生错误,请重试!"), f.value.formData.file = a;
459
+ g.value.additionalData = { file: e }, i(!0);
460
+ }), pe = (e, o) => {
461
+ g.value.formData.file = o;
462
+ }, ve = (e, o, i) => {
463
+ b.error("上传发生错误,请重试!"), g.value.formData.file = i;
457
464
  };
458
- return S(() => [u.disabled, h.value], () => {
459
- var t, o;
460
- (o = (t = h.value) == null ? void 0 : t.mode) == null || o.set(u.disabled ? "readonly" : "design");
465
+ return S(() => [u.disabled, x.value], () => {
466
+ var e, o;
467
+ (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(u.disabled ? "readonly" : "design");
461
468
  }, { immediate: !0 }), S(
462
- () => [u.value, h.value],
469
+ () => [u.value, x.value],
463
470
  () => {
464
- var t;
471
+ var e;
465
472
  if (P.value) {
466
473
  P.value = !1;
467
474
  return;
468
475
  }
469
- T.value = !0, (t = h.value) == null || t.setContent(u.value ? u.value : "");
476
+ T.value = !0, (e = x.value) == null || e.setContent(u.value ? u.value : "");
470
477
  },
471
478
  { immediate: !0 }
472
- ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef: h, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: m, mergeVideoUploadOptions: c, mergeAudioUploadOptions: v, mergeImgPondOptions: U, imgPondAccept: X, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: _, uploadImageFormRef: I, onUploadImageClose: W, onUploadImageConfirm: Y, uploadAudio: p, uploadAudioFormRef: $, onUploadAudioClose: E, onUploadAudioConfirm: Z, uploadVideo: f, uploadVideoFormRef: q, onUploadVideoClose: F, onUploadVideoConfirm: ee, onImageUploadUpload: ae, processPastedImage: N, getUploadAudioData: te, getUploadAudioHeaders: oe, onUploadAudioSuccess: ie, onUploadAudioBeforeUpload: le, onUploadAudioRemove: ne, onUploadAudioError: re, getUploadVideoData: se, getUploadVideoHeaders: ue, onUploadVideoSuccess: ce, onUploadVideoBeforeUpload: me, onUploadVideoRemove: de, onUploadVideoError: pe, ImgPond: ye };
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 };
473
480
  }
474
481
  });
475
482
  export {
476
- na as default
483
+ ra as default
477
484
  };
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.20",
5
+ "version": "0.0.12-alpha.21",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",