@keyblade/tinymce-editor-vue2 0.0.11 → 0.0.12-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/editor.vue2.js CHANGED
@@ -1,8 +1,9 @@
1
- import { defineComponent as N, ref as w, computed as k, onMounted as j, onUnmounted as L, watch as O } from "vue";
2
- import q from "compressorjs";
3
- import { conclude as _ } from "vue-global-config";
4
- import R from "tinymce";
5
- import E from "./langs/zh_CN.js";
1
+ import { defineComponent as ne, ref as u, computed as y, onMounted as re, onUnmounted as se, watch as O } from "vue";
2
+ import { oneTravelImageCheck as B, oneTravelImageCompressor as E, getImagePixel as me } from "./util.js";
3
+ import de from "imgpond";
4
+ import { conclude as M } from "vue-global-config";
5
+ import I from "tinymce";
6
+ import ue from "./langs/zh_CN.js";
6
7
  import "tinymce/skins/ui/oxide/skin";
7
8
  import "tinymce/models/dom";
8
9
  import "tinymce/themes/silver";
@@ -31,14 +32,17 @@ import "tinymce/plugins/table";
31
32
  import "tinymce/plugins/visualblocks";
32
33
  import "tinymce/plugins/visualchars";
33
34
  import "tinymce/plugins/wordcount";
34
- import { globalProps as d } from "./index.js";
35
- const ze = /* @__PURE__ */ N({
35
+ import { globalProps as x } from "./index.js";
36
+ import { Loading as pe, Message as f } from "element-ui";
37
+ const Qe = /* @__PURE__ */ ne({
36
38
  __name: "editor",
37
39
  props: {
38
40
  value: { default: "" },
39
41
  modelValue: { default: "" },
40
42
  disabled: { type: Boolean },
41
43
  extParameters: null,
44
+ imageUploadMaxCount: { default: 2 },
45
+ imageUploadTip: { default: "上传" },
42
46
  imageMaxSize: { default: 30 },
43
47
  imageAllowedType: { default: () => ["jpg", "jpeg", "png", "bmp", "heif", "gif", "webp"] },
44
48
  imageAllowedMineType: { default: () => ["image/jpg", "image/jpeg", "image/png", "image/bmp", "image/heif", "image/heic", "image/gif", "image/webp"] },
@@ -46,84 +50,155 @@ const ze = /* @__PURE__ */ N({
46
50
  imageMinHeight: { default: 60 },
47
51
  imageMaxWidth: { default: 6e3 },
48
52
  imageMaxHeight: { default: 6e3 },
53
+ audioMaxSize: { default: 200 },
54
+ audioAllowedType: { default: () => ["MP3", "M4A", "WAV", "AAC"] },
55
+ audioUploadOptions: null,
56
+ videoMaxSize: { default: 300 },
57
+ videoAllowedType: { default: () => ["MP4", "3GP"] },
58
+ videoUploadOptions: null,
49
59
  imageUploadHandle: null,
50
60
  paste_preprocess: null,
51
61
  paste_postprocess: null,
52
62
  initComplete: null,
53
- options: { default: () => ({}) }
63
+ options: { default: () => ({}) },
64
+ imgPondOptions: null
54
65
  },
55
66
  emits: ["input", "update:modelValue"],
56
- setup($, { emit: b }) {
57
- const t = $;
58
- R.addI18n("zh_CN", E);
59
- const P = w(), l = w(), g = w(!1), f = w(!1);
60
- async function T(n) {
61
- var a, e;
62
- const s = n.getElementsByTagName("img");
63
- for (let o of s) {
64
- const i = o.src;
65
- if (i.startsWith("http://") || i.startsWith("https://")) {
66
- const r = await M(i);
67
- if (r.width < t.imageMinWidth && r.height < t.imageMinHeight || r.width > t.imageMaxWidth && r.height > t.imageMaxHeight) {
68
- (a = o == null ? void 0 : o.remove) == null || a.call(o);
67
+ setup(F, { emit: S }) {
68
+ const a = F;
69
+ I.addI18n("zh_CN", ue);
70
+ const z = u(), m = u(), _ = u(!1), w = u(!1), v = u({
71
+ dialogVisible: !1,
72
+ formData: {
73
+ images: []
74
+ }
75
+ }), P = u(), N = () => {
76
+ v.value.dialogVisible = !1, v.value.formData = {
77
+ images: []
78
+ };
79
+ }, q = () => {
80
+ var t;
81
+ (t = P.value) == null || t.validate((n) => {
82
+ n && (v.value.formData.images.forEach((o) => {
83
+ var e;
84
+ (e = m.value) == null || e.insertContent(`<img src=${o} alt="" />`);
85
+ }), v.value.dialogVisible = !1, v.value.formData.images = []);
86
+ });
87
+ }, r = u({
88
+ dialogVisible: !1,
89
+ formData: {
90
+ // 名称
91
+ name: "",
92
+ // 封面
93
+ cover: [],
94
+ // 文件
95
+ file: []
96
+ }
97
+ }), k = u(), j = () => {
98
+ var t;
99
+ (t = k.value) == null || t.validate((n) => {
100
+ var o, e;
101
+ n && ((e = m.value) == null || e.insertContent(`<audio controls data-name="${r.value.formData.name}" data-poster="${r.value.formData.cover[0]}" src="${(o = r.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), r.value.dialogVisible = !1, r.value.formData = {
102
+ name: "",
103
+ cover: [],
104
+ file: []
105
+ });
106
+ });
107
+ }, G = () => {
108
+ r.value.dialogVisible = !1, r.value.formData = {
109
+ name: "",
110
+ cover: [],
111
+ file: []
112
+ };
113
+ }, d = u({
114
+ dialogVisible: !1,
115
+ formData: {
116
+ // 文件
117
+ file: []
118
+ }
119
+ }), W = u(), J = () => {
120
+ var t;
121
+ (t = W.value) == null || t.validate((n) => {
122
+ var o, e;
123
+ n && ((e = m.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(o = d.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), d.value.dialogVisible = !1, d.value.formData = {
124
+ file: []
125
+ });
126
+ });
127
+ }, K = () => {
128
+ d.value.dialogVisible = !1, d.value.formData = {
129
+ file: []
130
+ };
131
+ }, Q = (t, n) => new Promise(async (o, e) => {
132
+ var h;
133
+ const i = await B(t, {
134
+ imageMaxSize: a.imageMaxSize,
135
+ imageAllowedMineType: a.imageAllowedMineType,
136
+ imageMinWidth: a.imageMinWidth,
137
+ imageMinHeight: a.imageMinHeight,
138
+ imageMaxWidth: a.imageMaxWidth,
139
+ imageMaxHeight: a.imageMaxHeight
140
+ });
141
+ if (!i.success) {
142
+ e(), setTimeout(() => {
143
+ var p, g, b;
144
+ (p = i.error) != null && p.size ? n.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (g = i.error) != null && g.format ? n.onError(`请上传格式为${a.imageAllowedType.map((V) => V.toUpperCase()).join("、")}的图片`) : (b = i.error) != null && b.pixel && n.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
145
+ });
146
+ return;
147
+ }
148
+ const l = await E(t);
149
+ if (!l.success) {
150
+ e(), setTimeout(() => {
151
+ n.onError(l.errorMessage);
152
+ });
153
+ return;
154
+ }
155
+ const s = await ((h = c.value) == null ? void 0 : h.call(c, l.file, t.name, { extParameters: a.extParameters }));
156
+ if (!s.success) {
157
+ e(), setTimeout(() => {
158
+ n.onError(s.errorMessage);
159
+ });
160
+ return;
161
+ }
162
+ o(s.url);
163
+ });
164
+ async function $(t) {
165
+ var o, e;
166
+ const n = t.getElementsByTagName("img");
167
+ for (let i of n) {
168
+ const l = i.src;
169
+ if (l.startsWith("http://") || l.startsWith("https://")) {
170
+ const s = await me(l);
171
+ if (s.width < a.imageMinWidth && s.height < a.imageMinHeight || s.width > a.imageMaxWidth && s.height > a.imageMaxHeight) {
172
+ (o = i == null ? void 0 : i.remove) == null || o.call(i);
69
173
  return;
70
174
  }
71
- const y = i.split("."), C = y[y.length - 1].toLowerCase();
72
- if (!t.imageAllowedType.includes(C)) {
73
- (e = o == null ? void 0 : o.remove) == null || e.call(o);
175
+ const h = l.split("."), p = h[h.length - 1].toLowerCase();
176
+ if (!a.imageAllowedType.includes(p)) {
177
+ (e = i == null ? void 0 : i.remove) == null || e.call(i);
74
178
  return;
75
179
  }
76
180
  }
77
181
  }
78
182
  }
79
- const W = (n) => {
80
- const s = n.split(","), a = s[0].match(/:(.*?);/)[1], e = atob(s[1]);
81
- let o = e.length;
82
- const i = new Uint8Array(o);
83
- for (; o--; )
84
- i[o] = e.charCodeAt(o);
85
- return new Blob([i], { type: a });
86
- };
87
- function M(n) {
88
- return new Promise((s) => {
89
- const a = new Image();
90
- a.onload = function() {
91
- s({ width: a.width, height: a.height, image: a });
92
- }, a.src = n;
93
- });
94
- }
95
- function A(n, s) {
96
- return new Promise((a) => {
97
- new q(n, {
98
- ...s,
99
- success: async (e) => {
100
- a({ success: !0, file: e });
101
- },
102
- error(e) {
103
- a({ success: !1, error: e });
104
- }
105
- });
106
- });
107
- }
108
- const h = k(
109
- () => _([t.paste_preprocess, d.paste_preprocess], {
183
+ const A = y(() => M([a.videoUploadOptions, x.videoUploadOptions]) || {}), U = y(() => M([a.audioUploadOptions, x.audioUploadOptions]) || {}), X = y(() => M([a.imgPondOptions, x.imgPondOptions]) || {}), C = y(
184
+ () => M([a.paste_preprocess, x.paste_preprocess], {
110
185
  type: Function
111
186
  })
112
- ), v = k(
113
- () => _([t.paste_postprocess, d.paste_postprocess], {
187
+ ), T = y(
188
+ () => M([a.paste_postprocess, x.paste_postprocess], {
114
189
  type: Function
115
190
  })
116
- ), p = k(
117
- () => _([t.imageUploadHandle, d.imageUploadHandle], {
191
+ ), c = y(
192
+ () => M([a.imageUploadHandle, x.imageUploadHandle], {
118
193
  type: Function
119
194
  })
120
195
  );
121
- return j(() => {
122
- const n = {
196
+ re(() => {
197
+ const t = {
123
198
  // 设置语言
124
199
  language: "zh_CN",
125
200
  // 实例
126
- target: P.value,
201
+ target: z.value,
127
202
  // 隐藏品牌
128
203
  branding: !1,
129
204
  // 隐藏右上角升级按钮
@@ -140,6 +215,10 @@ const ze = /* @__PURE__ */ N({
140
215
  // - 小程序侧 web-view 中使用 iframe 需要配置业务域名
141
216
  // - 给微信公众号 H5 侧带来授权问题
142
217
  invalid_elements: "iframe,frame",
218
+ quickbars_insert_toolbar: !1,
219
+ autosave_restore_when_empty: !1,
220
+ image_advtab: !0,
221
+ image_caption: !0,
143
222
  // 插件
144
223
  plugins: [
145
224
  "accordion",
@@ -172,12 +251,18 @@ const ze = /* @__PURE__ */ N({
172
251
  "visualchars",
173
252
  "wordcount"
174
253
  ],
254
+ menu: {
255
+ insert: {
256
+ title: "菜单",
257
+ items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
258
+ }
259
+ },
175
260
  // 工具栏
176
261
  toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
177
262
  // 改动后刷新,不再弹 alert
178
263
  autosave_ask_before_unload: !1,
179
- // 内容样式
180
- content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:16px }",
264
+ // 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
265
+ content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }div[data-mce-bogus="all"] .mce-object-audio { display: none }div[data-mce-bogus="all"] .mce-object-video { display: none }',
181
266
  // 字体大小
182
267
  font_size_formats: "8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px",
183
268
  font_size_input_default_unit: "px",
@@ -188,90 +273,160 @@ const ze = /* @__PURE__ */ N({
188
273
  paste_webkit_styles: "all",
189
274
  paste_data_images: !0,
190
275
  // 粘贴前处理
191
- paste_preprocess(a, e) {
192
- var o;
193
- 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>"), (o = h.value) == null || o.call(h, a, e);
276
+ paste_preprocess(o, e) {
277
+ var i;
278
+ 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>"), (i = C.value) == null || i.call(C, o, e);
194
279
  },
195
280
  // 粘贴后处理(处理异步操作)
196
- paste_postprocess(a, e) {
197
- var i;
198
- const o = e.node;
199
- T(o), (i = v.value) == null || i.call(v, a, e);
281
+ paste_postprocess(o, e) {
282
+ var l;
283
+ const i = e.node;
284
+ $(i), (l = T.value) == null || l.call(T, o, e);
285
+ },
286
+ images_upload_handler(o) {
287
+ return new Promise(async (e, i) => {
288
+ var V, D, H, R;
289
+ const l = pe.service({ text: "上传中" });
290
+ let s = o.blob();
291
+ const h = o.filename(), p = await B(s, {
292
+ imageMaxSize: a.imageMaxSize,
293
+ imageAllowedMineType: a.imageAllowedMineType,
294
+ imageMinWidth: a.imageMinWidth,
295
+ imageMinHeight: a.imageMinHeight,
296
+ imageMaxWidth: a.imageMaxWidth,
297
+ imageMaxHeight: a.imageMaxHeight
298
+ });
299
+ if (!p.success) {
300
+ if (l == null || l.close(), (V = p.error) != null && V.size)
301
+ return i({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
302
+ if ((D = p.error) != null && D.format)
303
+ return i({ message: `请上传格式为${a.imageAllowedType.map((le) => le.toUpperCase()).join("、")}的图片`, remove: !0 });
304
+ if ((H = p.error) != null && H.pixel)
305
+ return i({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
306
+ }
307
+ const g = await E(s);
308
+ if (!g.success)
309
+ return l == null || l.close(), i({ message: g == null ? void 0 : g.errorMessage, remove: !0 });
310
+ if (!c.value)
311
+ return l == null || l.close(), i({ message: "缺少图片上传配置", remove: !0 });
312
+ const b = await ((R = c.value) == null ? void 0 : R.call(c, g.file, h, { extParameters: a.extParameters }));
313
+ if (!b.success)
314
+ return l == null || l.close(), i({ message: b.errorMessage, remove: !0 });
315
+ l == null || l.close(), e(b.url);
316
+ });
200
317
  },
201
- images_upload_handler(a) {
202
- return new Promise(async (e, o) => {
203
- var x, U, V, B;
204
- const i = (U = (x = d.message) == null ? void 0 : x.loading) == null ? void 0 : U.call(x);
205
- let r = a.blob();
206
- const y = a.base64(), C = a.filename(), F = r.type;
207
- if (r.size > t.imageMaxSize * 1024 * 1024)
208
- return i == null || i.close(), o({ message: `请上传大小不超过${t.imageMaxSize}M的图片`, remove: !0 });
209
- if (!t.imageAllowedMineType.includes(r.type))
210
- return i == null || i.close(), o({ message: `请上传格式为${t.imageAllowedType.map((c) => c.toUpperCase()).join("、")}的图片`, remove: !0 });
211
- const H = "data:" + r.type + ";base64," + y, u = await M(H);
212
- if (u.width < t.imageMinWidth && u.height < t.imageMinHeight || u.width > t.imageMaxWidth && u.height > t.imageMaxHeight)
213
- return i == null || i.close(), o({ message: `请上传像素不低于${t.imageMinWidth}*${t.imageMinHeight}且像素不高于${t.imageMaxWidth}*${t.imageMaxHeight}的图片`, remove: !0 });
214
- const m = {};
215
- ["image/heif", "image/heic", "image/webp"].includes(F) && (m.convertTypes = [r.type], m.convertSize = 0);
216
- const z = 5 * 1024 * 1024;
217
- if (r.size > z && (m.convertTypes = [r.type], m.convertSize = z, m.maxWidth = u.width * (z / r.size)), Object.keys(m).length > 0) {
218
- const c = await A(W(H), m);
219
- if (c.success)
220
- r = c.file;
221
- else
222
- return i == null || i.close(), o({ message: (V = c == null ? void 0 : c.error) == null ? void 0 : V.message, remove: !0 });
318
+ setup(o) {
319
+ o.ui.registry.addMenuItem("localImage", {
320
+ text: "图片",
321
+ icon: "image",
322
+ onAction: () => {
323
+ v.value.dialogVisible = !0, setTimeout(() => {
324
+ var i;
325
+ const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
326
+ e && (e.innerHTML = a.imageUploadTip || "上传");
327
+ });
328
+ }
329
+ }), o.ui.registry.addMenuItem("localAudio", {
330
+ text: "音频",
331
+ icon: "arrow-right",
332
+ onAction: () => {
333
+ r.value.dialogVisible = !0, setTimeout(() => {
334
+ var i;
335
+ const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
336
+ e && (e.innerHTML = a.imageUploadTip || "上传");
337
+ });
338
+ }
339
+ }), o.ui.registry.addMenuItem("localVideo", {
340
+ text: "视频",
341
+ icon: "embed",
342
+ onAction: () => {
343
+ d.value.dialogVisible = !0;
223
344
  }
224
- if (!p.value)
225
- return i == null || i.close(), o({ message: "缺少图片上传配置", remove: !0 });
226
- const S = await ((B = p.value) == null ? void 0 : B.call(p, r, C, { extParameters: t.extParameters }));
227
- if (!S.success)
228
- return i == null || i.close(), o({ message: S.errorMessage, remove: !0 });
229
- i == null || i.close(), e(S.url);
230
345
  });
231
346
  }
232
- }, s = _(
347
+ }, n = M(
233
348
  [
234
- t.options,
235
- d.tinymceOptions,
236
- n
349
+ a.options,
350
+ x.tinymceOptions,
351
+ t
237
352
  ],
238
353
  {
239
- mergeFunction: (a, e) => (...o) => {
240
- a(...o), e(...o);
354
+ mergeFunction: (o, e) => (...i) => {
355
+ o(...i), e(...i);
241
356
  },
242
357
  type: Object
243
358
  }
244
359
  );
245
- R.init(s).then(([a]) => {
360
+ I.init(n).then(([o]) => {
246
361
  var e;
247
- a && (a.customProps = { ...t }, a.on("change input Redo Undo SetContent", () => {
248
- if (f.value) {
249
- f.value = !1;
362
+ o && (o.customProps = { ...a }, o.on("change input Redo Undo SetContent", () => {
363
+ if (w.value) {
364
+ w.value = !1;
250
365
  return;
251
366
  }
252
- g.value = !0, b("input", a.getContent()), b("update:modelValue", a.getContent());
253
- }), (e = t.initComplete) == null || e.call(t, { editorIns: a }), l.value = a);
367
+ _.value = !0, S("input", o.getContent()), S("update:modelValue", o.getContent());
368
+ }), (e = a.initComplete) == null || e.call(a, { editorIns: o }), m.value = o);
254
369
  });
255
- }), L(() => {
256
- var n;
257
- (n = l.value) == null || n.destroy();
258
- }), O(() => [t.disabled, l.value], () => {
259
- var n, s;
260
- (s = (n = l.value) == null ? void 0 : n.mode) == null || s.set(t.disabled ? "readonly" : "design");
370
+ });
371
+ const Y = (t, n, o) => {
372
+ var i, l;
373
+ const e = (l = (i = U == null ? void 0 : U.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : l.call(i, t);
374
+ e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), o.splice(o.length - 1, 1)), r.value.formData.file = o;
375
+ }, Z = (t, n) => new Promise((o, e) => {
376
+ const i = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
377
+ if (!a.audioAllowedType.includes(i.toUpperCase())) {
378
+ f.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
379
+ return;
380
+ }
381
+ if (t.size > a.audioMaxSize * 1024 * 1024) {
382
+ f.info(`请上传${a.audioMaxSize}M内的音频`), e();
383
+ return;
384
+ }
385
+ o(!0);
386
+ }), L = (t, n) => {
387
+ r.value.formData.file = n;
388
+ }, ee = (t, n, o) => {
389
+ f.error("上传发生错误,请重试!"), r.value.formData.file = o;
390
+ }, ae = (t, n, o) => {
391
+ var i, l;
392
+ const e = (l = (i = A == null ? void 0 : A.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : l.call(i, t);
393
+ e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), o.splice(o.length - 1, 1)), d.value.formData.file = o;
394
+ }, oe = (t, n) => new Promise((o, e) => {
395
+ const i = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
396
+ if (!a.videoAllowedType.includes(i.toUpperCase())) {
397
+ f.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
398
+ return;
399
+ }
400
+ if (t.size > a.videoMaxSize * 1024 * 1024) {
401
+ f.info(`请上传${a.videoMaxSize}M内的视频`), e();
402
+ return;
403
+ }
404
+ o(!0);
405
+ }), ie = (t, n) => {
406
+ d.value.formData.file = n;
407
+ }, te = (t, n, o) => {
408
+ f.error("上传发生错误,请重试!"), d.value.formData.file = o;
409
+ };
410
+ return se(() => {
411
+ var t;
412
+ (t = m.value) == null || t.destroy();
413
+ }), O(() => [a.disabled, m.value], () => {
414
+ var t, n;
415
+ (n = (t = m.value) == null ? void 0 : t.mode) == null || n.set(a.disabled ? "readonly" : "design");
261
416
  }, { immediate: !0 }), O(
262
- () => [t.value, t.modelValue, l.value],
417
+ () => [a.value, a.modelValue, m.value],
263
418
  () => {
264
- var n;
265
- if (g.value) {
266
- g.value = !1;
419
+ var t;
420
+ if (_.value) {
421
+ _.value = !1;
267
422
  return;
268
423
  }
269
- f.value = !0, (n = l.value) == null || n.setContent(t.value ? t.value : t.modelValue ? t.modelValue : "");
424
+ w.value = !0, (t = m.value) == null || t.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
270
425
  },
271
426
  { immediate: !0 }
272
- ), { __sfc: !0, insRef: P, editorRef: l, preventSettingContent: g, preventUpdatingModelValue: f, props: t, emits: b, processPastedImage: T, dataURLtoBlob: W, getImagePixel: M, compressorImage: A, paste_preprocess: h, paste_postprocess: v, imageUploadHandle: p };
427
+ ), { __sfc: !0, insRef: z, editorRef: m, preventSettingContent: _, preventUpdatingModelValue: w, uploadImage: v, uploadImageFormRef: P, onUploadImageClose: N, onUploadImageConfirm: q, uploadAudio: r, uploadAudioFormRef: k, onUploadAudioConfirm: j, onUploadAudioClose: G, uploadVideo: d, uploadVideoFormRef: W, onUploadVideoConfirm: J, onUploadVideoClose: K, onImageUploadUpload: Q, props: a, emits: S, processPastedImage: $, mergeVideoUploadOptions: A, mergeAudioUploadOptions: U, mergeImgPondOptions: X, paste_preprocess: C, paste_postprocess: T, imageUploadHandle: c, onUploadAudioSuccess: Y, onUploadAudioBeforeUpload: Z, onUploadAudioRemove: L, onUploadAudioError: ee, onUploadVideoSuccess: ae, onUploadVideoBeforeUpload: oe, onUploadVideoRemove: ie, onUploadVideoError: te, ImgPond: de };
273
428
  }
274
429
  });
275
430
  export {
276
- ze as default
431
+ Qe as default
277
432
  };