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

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