@keyblade/tinymce-editor-vue2 0.0.12-alpha.2 → 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,9 +1,10 @@
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 E, oneTravelImageCompressor as I, getImagePixel as me } from "./util.js";
3
- import de from "imgpond";
4
- import { conclude as M } from "vue-global-config";
5
- import B from "tinymce";
6
- import ue 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";
7
8
  import "tinymce/skins/ui/oxide/skin";
8
9
  import "tinymce/models/dom";
9
10
  import "tinymce/themes/silver";
@@ -32,59 +33,99 @@ import "tinymce/plugins/table";
32
33
  import "tinymce/plugins/visualblocks";
33
34
  import "tinymce/plugins/visualchars";
34
35
  import "tinymce/plugins/wordcount";
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
+ import { globalProps as C } from "./index.js";
37
+ import { Loading as k, Message as b } from "element-ui";
38
+ const na = /* @__PURE__ */ ve({
38
39
  __name: "editor",
39
40
  props: {
40
41
  value: { default: "" },
41
- modelValue: { default: "" },
42
- disabled: { type: Boolean },
43
- extParameters: null,
44
- imageUploadMaxCount: { default: 2 },
45
- imageUploadTip: { default: "上传" },
46
- imageMaxSize: { default: 30 },
47
- imageAllowedType: { default: () => ["jpg", "jpeg", "png", "bmp", "heif", "gif", "webp"] },
48
- imageAllowedMineType: { default: () => ["image/jpg", "image/jpeg", "image/png", "image/bmp", "image/heif", "image/heic", "image/gif", "image/webp"] },
49
- imageMinWidth: { default: 60 },
50
- imageMinHeight: { default: 60 },
51
- imageMaxWidth: { default: 6e3 },
52
- imageMaxHeight: { default: 6e3 },
53
- audioMaxSize: { default: 200 },
54
- audioAllowedType: { default: () => ["MP3", "M4A", "WAV", "AAC"] },
42
+ disabled: { type: Boolean, default: !1 },
43
+ extParameters: { default: () => ({}) },
44
+ options: { default: () => ({}) },
45
+ imageUploadOptions: null,
46
+ imgPondOptions: null,
55
47
  audioUploadOptions: null,
56
- videoMaxSize: { default: 300 },
57
- videoAllowedType: { default: () => ["MP4", "3GP"] },
58
48
  videoUploadOptions: null,
59
- imageUploadHandle: null,
60
- paste_preprocess: null,
61
- paste_postprocess: null,
62
- initComplete: null,
63
- options: { default: () => ({}) },
64
- imgPondOptions: null
49
+ initComplete: null
65
50
  },
66
- emits: ["input", "update:modelValue"],
67
- setup(F, { emit: S }) {
68
- const a = F;
69
- B.addI18n("zh_CN", ue);
70
- const z = u(), m = u(), _ = u(!1), w = u(!1), v = u({
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, {
81
+ onStart: () => {
82
+ t = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
83
+ },
84
+ onSuccess: () => {
85
+ t == null || t.close();
86
+ },
87
+ onError: (o) => {
88
+ t == null || t.close(), b.error(o);
89
+ }
90
+ });
91
+ }
92
+ }, { immediate: !0 });
93
+ const M = g();
94
+ S(() => M.value, () => {
95
+ if (M.value) {
96
+ let t;
97
+ L(M.value, {
98
+ onStart: () => {
99
+ t = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
100
+ },
101
+ onSuccess: () => {
102
+ t == null || t.close();
103
+ },
104
+ onError: (o) => {
105
+ t == null || t.close(), b.error(o);
106
+ }
107
+ });
108
+ }
109
+ }, { immediate: !0 });
110
+ const _ = g({
71
111
  dialogVisible: !1,
72
112
  formData: {
73
113
  images: []
74
114
  }
75
- }), P = u(), N = () => {
76
- v.value.dialogVisible = !1, v.value.formData = {
115
+ }), I = g(), W = () => {
116
+ _.value.dialogVisible = !1, _.value.formData = {
77
117
  images: []
78
118
  };
79
- }, q = () => {
119
+ }, Y = () => {
80
120
  var t;
81
- (t = P.value) == null || t.validate((n) => {
82
- n && (v.value.formData.images.forEach((i) => {
83
- var e;
84
- (e = m.value) == null || e.insertContent(`<img src=${i} alt="" />`);
85
- }), v.value.dialogVisible = !1, v.value.formData.images = []);
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());
86
127
  });
87
- }, r = u({
128
+ }, p = g({
88
129
  dialogVisible: !1,
89
130
  formData: {
90
131
  // 名称
@@ -93,112 +134,82 @@ const Qe = /* @__PURE__ */ ne({
93
134
  cover: [],
94
135
  // 文件
95
136
  file: []
96
- }
97
- }), k = u(), j = () => {
98
- var t;
99
- (t = k.value) == null || t.validate((n) => {
100
- var i, 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="${(i = r.value.formData.file[0]) == null ? void 0 : i.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 = {
137
+ },
138
+ // 用于临时保存上传前的参数 { file: File }
139
+ additionalData: {}
140
+ }), $ = g(), E = () => {
141
+ p.value.dialogVisible = !1, p.value.formData = {
109
142
  name: "",
110
143
  cover: [],
111
144
  file: []
112
- };
113
- }, d = u({
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({
114
153
  dialogVisible: !1,
115
154
  formData: {
116
155
  // 文件
117
156
  file: []
118
- }
119
- }), W = u(), J = () => {
120
- var t;
121
- (t = W.value) == null || t.validate((n) => {
122
- var i, e;
123
- n && ((e = m.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(i = d.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), d.value.dialogVisible = !1, d.value.formData = {
124
- file: []
125
- });
126
- });
127
- }, K = () => {
128
- d.value.dialogVisible = !1, d.value.formData = {
157
+ },
158
+ // 用于临时保存上传前的参数 { file: File }
159
+ additionalData: {}
160
+ }), q = g(), F = () => {
161
+ f.value.dialogVisible = !1, f.value.formData = {
129
162
  file: []
130
- };
131
- }, Q = (t, n) => new Promise(async (i, e) => {
132
- var h;
133
- const o = await E(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
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());
140
169
  });
141
- if (!o.success) {
142
- e(), setTimeout(() => {
143
- var p, g, b;
144
- (p = o.error) != null && p.size ? n.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (g = o.error) != null && g.format ? n.onError(`请上传格式为${a.imageAllowedType.map((V) => V.toUpperCase()).join("、")}的图片`) : (b = o.error) != null && b.pixel && n.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
145
- });
146
- return;
147
- }
148
- const l = await I(t);
170
+ }, ae = (t, o) => new Promise(async (a, e) => {
171
+ var n, r;
172
+ const l = await J(t);
149
173
  if (!l.success) {
150
174
  e(), setTimeout(() => {
151
- n.onError(l.errorMessage);
175
+ o.onError(l.errorMessage);
152
176
  });
153
177
  return;
154
178
  }
155
- const s = await ((h = c.value) == null ? void 0 : h.call(c, l.file, t.name, { extParameters: a.extParameters }));
156
- if (!s.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)) {
157
181
  e(), setTimeout(() => {
158
- n.onError(s.errorMessage);
182
+ o.onError(i == null ? void 0 : i.errorMessage);
159
183
  });
160
184
  return;
161
185
  }
162
- i(s.url);
186
+ a(i.url);
163
187
  });
164
- async function $(t) {
165
- var i, e;
166
- const n = t.getElementsByTagName("img");
167
- for (let o of n) {
168
- const l = o.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
- (i = o == null ? void 0 : o.remove) == null || i.call(o);
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);
173
197
  return;
174
198
  }
175
- const h = l.split("."), p = h[h.length - 1].toLowerCase();
176
- if (!a.imageAllowedType.includes(p)) {
177
- (e = o == null ? void 0 : o.remove) == null || e.call(o);
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);
178
202
  return;
179
203
  }
180
204
  }
181
205
  }
182
206
  }
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], {
185
- type: Function
186
- })
187
- ), T = y(
188
- () => M([a.paste_postprocess, x.paste_postprocess], {
189
- type: Function
190
- })
191
- ), c = y(
192
- () => M([a.imageUploadHandle, x.imageUploadHandle], {
193
- type: Function
194
- })
195
- );
196
- re(() => {
207
+ fe(() => {
197
208
  const t = {
198
209
  // 设置语言
199
210
  language: "zh_CN",
200
211
  // 实例
201
- target: z.value,
212
+ target: R.value,
202
213
  // 隐藏品牌
203
214
  branding: !1,
204
215
  // 隐藏右上角升级按钮
@@ -253,12 +264,13 @@ const Qe = /* @__PURE__ */ ne({
253
264
  ],
254
265
  menu: {
255
266
  insert: {
256
- title: "菜单",
267
+ title: "插入",
257
268
  items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
258
269
  }
259
270
  },
271
+ toolbar_mode: "sliding",
260
272
  // 工具栏
261
- toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
273
+ toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | localImage localAudio localVideo link anchor | ltr rtl",
262
274
  // 改动后刷新,不再弹 alert
263
275
  autosave_ask_before_unload: !1,
264
276
  // 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
@@ -273,160 +285,193 @@ const Qe = /* @__PURE__ */ ne({
273
285
  paste_webkit_styles: "all",
274
286
  paste_data_images: !0,
275
287
  // 粘贴前处理
276
- paste_preprocess(i, e) {
277
- var o;
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>"), (o = C.value) == null || o.call(C, i, 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>");
279
290
  },
280
291
  // 粘贴后处理(处理异步操作)
281
- paste_postprocess(i, e) {
282
- var l;
283
- const o = e.node;
284
- $(o), (l = T.value) == null || l.call(T, i, e);
292
+ paste_postprocess(a, e) {
293
+ N(e.node);
285
294
  },
286
- images_upload_handler(i) {
287
- return new Promise(async (e, o) => {
288
- var V, D, H, R;
289
- const l = pe.service({ text: "上传中" });
290
- let s = i.blob();
291
- const h = i.filename(), p = await E(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
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
298
310
  });
299
- if (!p.success) {
300
- if (l == null || l.close(), (V = p.error) != null && V.size)
301
- return o({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
302
- if ((D = p.error) != null && D.format)
303
- return o({ message: `请上传格式为${a.imageAllowedType.map((le) => le.toUpperCase()).join("、")}的图片`, remove: !0 });
304
- if ((H = p.error) != null && H.pixel)
305
- return o({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
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`;
306
314
  }
307
- const g = await I(s);
308
- if (!g.success)
309
- return l == null || l.close(), o({ message: g == null ? void 0 : g.errorMessage, remove: !0 });
310
- if (!c.value)
311
- return l == null || l.close(), o({ 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(), o({ message: b.errorMessage, remove: !0 });
315
- l == null || l.close(), e(b.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);
316
322
  });
317
323
  },
318
- setup(i) {
319
- i.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", {
320
334
  text: "图片",
321
335
  icon: "image",
322
- onAction: () => {
323
- v.value.dialogVisible = !0, setTimeout(() => {
324
- var o;
325
- const e = (o = document == null ? void 0 : document.querySelector) == null ? void 0 : o.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
326
- e && (e.innerHTML = a.imageUploadTip || "上传");
327
- });
328
- }
329
- }), i.ui.registry.addMenuItem("localAudio", {
330
- text: "音频",
331
- icon: "arrow-right",
332
- onAction: () => {
333
- r.value.dialogVisible = !0, setTimeout(() => {
334
- var o;
335
- const e = (o = document == null ? void 0 : document.querySelector) == null ? void 0 : o.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
336
- e && (e.innerHTML = a.imageUploadTip || "上传");
336
+ onAction: () => e()
337
+ }), a.ui.registry.addButton("localImage", {
338
+ icon: "image",
339
+ 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) || "上传");
337
347
  });
338
- }
339
- }), i.ui.registry.addMenuItem("localVideo", {
340
- text: "视频",
341
- icon: "embed",
342
- onAction: () => {
343
- d.value.dialogVisible = !0;
344
- }
345
- });
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
+ }
346
373
  }
347
- }, n = M(
374
+ }, o = A(
348
375
  [
349
- a.options,
350
- x.tinymceOptions,
376
+ u.options,
377
+ C.options,
351
378
  t
352
379
  ],
353
380
  {
354
- mergeFunction: (i, e) => (...o) => {
355
- i(...o), e(...o);
381
+ mergeFunction: (a, e) => (...l) => {
382
+ a(...l), e(...l);
356
383
  },
357
384
  type: Object
358
385
  }
359
386
  );
360
- B.init(n).then(([i]) => {
387
+ K.init(o).then(([a]) => {
361
388
  var e;
362
- i && (i.customProps = { ...a }, i.on("change input Redo Undo SetContent", () => {
363
- if (w.value) {
364
- w.value = !1;
389
+ a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
390
+ if (T.value) {
391
+ T.value = !1;
365
392
  return;
366
393
  }
367
- _.value = !0, S("input", i.getContent()), S("update:modelValue", i.getContent());
368
- }), (e = a.initComplete) == null || e.call(a, { editorIns: i }), m.value = i);
394
+ P.value = !0, z("input", a.getContent());
395
+ }), (e = u.initComplete) == null || e.call(u, { editorIns: a }), h.value = a);
369
396
  });
397
+ }), ge(() => {
398
+ var t;
399
+ (t = h.value) == null || t.destroy();
370
400
  });
371
- const Y = (t, n, i) => {
372
- var o, l;
373
- const e = (l = (o = U == null ? void 0 : U.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : l.call(o, t);
374
- e != null && e.url ? i[i.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), i.splice(i.length - 1, 1)), r.value.formData.file = i;
375
- }, Z = (t, n) => new Promise((i, e) => {
376
- const o = t.name.split(".").filter(Boolean).pop() ?? "";
377
- if (!a.audioAllowedType.includes(o.toUpperCase())) {
378
- f.info(`请上传格式为${a.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();
379
418
  return;
380
419
  }
381
- if (t.size > a.audioMaxSize * 1024 * 1024) {
382
- f.info(`请上传${a.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();
383
422
  return;
384
423
  }
385
- i(!0);
386
- }), L = (t, n) => {
387
- r.value.formData.file = n;
388
- }, ee = (t, n, i) => {
389
- f.error("上传发生错误,请重试!"), r.value.formData.file = i;
390
- }, ae = (t, n, i) => {
391
- var o, l;
392
- const e = (l = (o = A == null ? void 0 : A.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : l.call(o, t);
393
- e != null && e.url ? i[i.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), i.splice(i.length - 1, 1)), d.value.formData.file = i;
394
- }, ie = (t, n) => new Promise((i, e) => {
395
- const o = t.name.split(".").filter(Boolean).pop() ?? "";
396
- if (!a.videoAllowedType.includes(o.toUpperCase())) {
397
- f.info(`请上传格式为${a.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();
398
446
  return;
399
447
  }
400
- if (t.size > a.videoMaxSize * 1024 * 1024) {
401
- f.info(`请上传${a.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();
402
450
  return;
403
451
  }
404
- i(!0);
405
- }), oe = (t, n) => {
406
- d.value.formData.file = n;
407
- }, te = (t, n, i) => {
408
- f.error("上传发生错误,请重试!"), d.value.formData.file = i;
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;
409
457
  };
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");
416
- }, { immediate: !0 }), O(
417
- () => [a.value, a.modelValue, m.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],
418
463
  () => {
419
464
  var t;
420
- if (_.value) {
421
- _.value = !1;
465
+ if (P.value) {
466
+ P.value = !1;
422
467
  return;
423
468
  }
424
- w.value = !0, (t = m.value) == null || t.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
469
+ T.value = !0, (t = h.value) == null || t.setContent(u.value ? u.value : "");
425
470
  },
426
471
  { immediate: !0 }
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: ie, onUploadVideoRemove: oe, onUploadVideoError: te, ImgPond: de };
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 };
428
473
  }
429
474
  });
430
475
  export {
431
- Qe as default
476
+ na as default
432
477
  };