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

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 +213 -197
  2. package/package.json +1 -1
package/es/editor.vue2.js CHANGED
@@ -1,9 +1,9 @@
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";
5
- import { conclude as A } from "vue-global-config";
6
- import K from "tinymce";
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
7
  import _e from "./langs/zh_CN.js";
8
8
  import "tinymce/skins/ui/oxide/skin";
9
9
  import "tinymce/models/dom";
@@ -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 na = /* @__PURE__ */ ve({
38
+ const ra = /* @__PURE__ */ ge({
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(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,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 = _(() => 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
+ 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 w = h({
111
111
  dialogVisible: !1,
112
112
  formData: {
113
113
  images: []
114
114
  }
115
- }), I = g(), W = () => {
116
- _.value.dialogVisible = !1, _.value.formData = {
115
+ }), W = h(), j = () => {
116
+ w.value.dialogVisible = !1, w.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
+ }, ee = () => {
120
+ var e;
121
+ (e = W.value) == null || e.validate((o) => {
122
+ o && (w.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
+ }, v = 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 = () => {
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
- }, 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());
145
+ }, v.value.additionalData = {};
146
+ }, ae = () => {
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="${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
- }, f = g({
152
+ }, g = h({
153
153
  dialogVisible: !1,
154
154
  formData: {
155
155
  // 文件
@@ -157,55 +157,58 @@ 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
+ }), I = 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
+ }, te = () => {
165
+ var e;
166
+ (e = I.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
+ }, oe = (e, o) => new Promise(async (i, a) => {
171
+ var r, l;
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 ((l = (r = c.value).handleRequest) == null ? void 0 : l.call(r, t.file, e.name, { extParameters: m.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;
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);
188
+ async function F(e) {
189
+ var i, a, t, n, r;
190
+ const o = e.getElementsByTagName("img");
191
+ for (let l of o) {
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 = 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);
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
- fe(() => {
208
- const t = {
209
+ he(() => {
210
+ var i;
211
+ const e = {
209
212
  // 设置语言
210
213
  language: "zh_CN",
211
214
  // 实例
@@ -284,194 +287,207 @@ const na = /* @__PURE__ */ ve({
284
287
  convert_urls: !1,
285
288
  paste_webkit_styles: "all",
286
289
  paste_data_images: !0,
290
+ images_file_types: ((i = c.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
287
291
  // 粘贴前处理
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>");
292
+ paste_preprocess(a, t) {
293
+ 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
294
  },
291
295
  // 粘贴后处理(处理异步操作)
292
- paste_postprocess(a, e) {
293
- N(e.node);
296
+ paste_postprocess(a, t) {
297
+ F(t.node);
294
298
  },
295
299
  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,
300
+ return new Promise(async (t, n) => {
301
+ var N, O, L;
302
+ if (!((N = c.value) != null && N.handleRequest))
303
+ return n({ message: "缺少图片上传配置", remove: !0 });
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, {
309
+ imageMaxSize: c.value.maxSize,
310
+ imageAllowedType: c.value.allowedType,
305
311
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
306
- imageMinWidth: m.value.minWidth,
307
- imageMinHeight: m.value.minHeight,
308
- imageMaxWidth: m.value.maxWidth,
309
- imageMaxHeight: m.value.maxHeight
312
+ imageMinWidth: c.value.minWidth,
313
+ imageMinHeight: c.value.minHeight,
314
+ imageMaxWidth: c.value.maxWidth,
315
+ imageMaxHeight: c.value.maxHeight
310
316
  });
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`;
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`;
314
323
  }
315
- const d = await J(n);
316
- 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);
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 }));
328
+ if (!y || !y.success)
329
+ return r == null || r.close(), n({ message: y.errorMessage, remove: !0 });
330
+ r == null || r.close(), t(y.url);
322
331
  });
323
332
  },
324
333
  setup(a) {
325
- var l, i;
326
- const e = () => {
327
- _.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) || "上传");
334
+ var n, r;
335
+ const t = () => {
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) || "上传");
331
340
  });
332
341
  };
333
342
  if (a.ui.registry.addMenuItem("localImage", {
334
343
  text: "图片",
335
344
  icon: "image",
336
- onAction: () => e()
345
+ onAction: () => t()
337
346
  }), a.ui.registry.addButton("localImage", {
338
347
  icon: "image",
339
348
  tooltip: "图片",
340
- onAction: () => e()
341
- }), (l = v == null ? void 0 : v.value) != null && l.enable) {
342
- const n = () => {
343
- 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) || "上传");
349
+ onAction: () => t()
350
+ }), (n = f == null ? void 0 : f.value) != null && n.enable) {
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) || "上传");
347
356
  });
348
357
  };
349
358
  a.ui.registry.addMenuItem("localAudio", {
350
359
  text: "音频",
351
360
  icon: "arrow-right",
352
- onAction: () => n()
361
+ onAction: () => l()
353
362
  }), a.ui.registry.addButton("localAudio", {
354
363
  icon: "arrow-right",
355
364
  tooltip: "音频",
356
- onAction: () => n()
365
+ onAction: () => l()
357
366
  });
358
367
  }
359
- if ((i = c == null ? void 0 : c.value) != null && i.enable) {
360
- const n = () => {
361
- f.value.dialogVisible = !0;
368
+ if ((r = d == null ? void 0 : d.value) != null && r.enable) {
369
+ const l = () => {
370
+ g.value.dialogVisible = !0;
362
371
  };
363
372
  a.ui.registry.addMenuItem("localVideo", {
364
373
  text: "视频",
365
374
  icon: "embed",
366
- onAction: () => n()
375
+ onAction: () => l()
367
376
  }), a.ui.registry.addButton("localVideo", {
368
377
  icon: "embed",
369
378
  tooltip: "视频",
370
- onAction: () => n()
379
+ onAction: () => l()
371
380
  });
372
381
  }
373
382
  }
374
- }, o = A(
383
+ }, o = C(
375
384
  [
376
- u.options,
377
- C.options,
378
- t
385
+ m.options,
386
+ A.options,
387
+ e
379
388
  ],
380
389
  {
381
- mergeFunction: (a, e) => (...l) => {
382
- a(...l), e(...l);
390
+ mergeFunction: (a, t) => (...n) => {
391
+ a(...n), t(...n);
383
392
  },
384
393
  type: Object
385
394
  }
386
395
  );
387
- K.init(o).then(([a]) => {
388
- var e;
389
- a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
396
+ X.init(o).then(([a]) => {
397
+ var t;
398
+ a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
390
399
  if (T.value) {
391
400
  T.value = !1;
392
401
  return;
393
402
  }
394
403
  P.value = !0, z("input", a.getContent());
395
- }), (e = u.initComplete) == null || e.call(u, { editorIns: a }), h.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);
396
412
  });
397
- }), ge(() => {
398
- var t;
399
- (t = h.value) == null || t.destroy();
413
+ }), xe(() => {
414
+ var e;
415
+ (e = x.value) == null || e.destroy();
400
416
  });
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();
417
+ const ie = () => {
418
+ var o, i;
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 = () => {
422
+ var 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) => {
426
+ var t, n;
427
+ const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
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;
431
+ const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
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();
418
434
  return;
419
435
  }
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();
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();
422
438
  return;
423
439
  }
424
- p.value.additionalData = { file: t }, a(!0);
425
- }), ne = (t, o) => {
426
- 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 })) || {};
433
- }, 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();
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 = () => {
446
+ var o, i;
447
+ const e = { ...g.value.additionalData || {} };
448
+ return ((i = (o = d.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
449
+ }, me = () => {
450
+ var o, i;
451
+ const e = { ...g.value.additionalData || {} };
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) => {
454
+ var t, n;
455
+ const a = (n = (t = d == null ? void 0 : d.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
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;
457
+ }, pe = (e, o) => new Promise((i, a) => {
458
+ var n, r, l, s, u, p;
459
+ const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
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();
446
462
  return;
447
463
  }
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();
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();
450
466
  return;
451
467
  }
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;
468
+ g.value.additionalData = { file: e }, i(!0);
469
+ }), ve = (e, o) => {
470
+ g.value.formData.file = o;
471
+ }, fe = (e, o, i) => {
472
+ b.error("上传发生错误,请重试!"), g.value.formData.file = i;
457
473
  };
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");
474
+ return S(() => [m.disabled, x.value], () => {
475
+ var e, o;
476
+ (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(m.disabled ? "readonly" : "design");
461
477
  }, { immediate: !0 }), S(
462
- () => [u.value, h.value],
478
+ () => [m.value, x.value],
463
479
  () => {
464
- var t;
480
+ var e;
465
481
  if (P.value) {
466
482
  P.value = !1;
467
483
  return;
468
484
  }
469
- T.value = !0, (t = h.value) == null || t.setContent(u.value ? u.value : "");
485
+ T.value = !0, (e = x.value) == null || e.setContent(m.value ? m.value : "");
470
486
  },
471
487
  { 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 };
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 };
473
489
  }
474
490
  });
475
491
  export {
476
- na as default
492
+ ra as default
477
493
  };
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.22",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",