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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 fe, ref as h, computed as w, watch as S, onMounted as ge, onUnmounted as he } from "vue";
2
+ import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as xe, oneTravelImageCompressor as K } from "@keyblade/one-travel";
3
+ import { getImagePixel as be, getFileExtension as ye } from "./util.js";
4
+ import _e from "imgpond";
5
+ import { conclude as A } from "vue-global-config";
6
+ import Q from "tinymce";
7
+ import we 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 ra = /* @__PURE__ */ fe({
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(X, { emit: z }) {
53
+ const u = X;
54
+ Q.addI18n("zh_CN", we);
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 = h(), x = h(), P = h(!1), T = h(!1), c = w(() => A([u.imageUploadOptions, C.imageUploadOptions, V]) || {}), m = w(() => A([u.videoUploadOptions, C.videoUploadOptions, B]) || {}), f = w(() => A([u.audioUploadOptions, C.audioUploadOptions, H]) || {}), U = w(() => A([u.imgPondOptions, C.imgPondOptions]) || {}), Y = w(() => {
74
+ var e, o;
75
+ return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
76
+ }), D = h();
77
+ S(() => D.value, () => {
78
+ if (D.value) {
79
+ let e;
80
+ J(D.value, {
81
+ onStart: () => {
82
+ e = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
83
+ },
84
+ onSuccess: () => {
85
+ e == null || e.close();
86
+ },
87
+ onError: (o) => {
88
+ e == null || e.close(), b.error(o);
89
+ }
90
+ });
91
+ }
92
+ }, { immediate: !0 });
93
+ const M = h();
94
+ S(() => M.value, () => {
95
+ if (M.value) {
96
+ let e;
97
+ J(M.value, {
98
+ onStart: () => {
99
+ e = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
100
+ },
101
+ onSuccess: () => {
102
+ e == null || e.close();
103
+ },
104
+ onError: (o) => {
105
+ e == null || e.close(), b.error(o);
106
+ }
107
+ });
108
+ }
109
+ }, { immediate: !0 });
110
+ const _ = h({
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
+ }), W = h(), j = () => {
116
+ _.value.dialogVisible = !1, _.value.formData = {
77
117
  images: []
78
118
  };
79
- }, q = () => {
80
- 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 = []);
119
+ }, Z = () => {
120
+ var e;
121
+ (e = W.value) == null || e.validate((o) => {
122
+ o && (_.value.formData.images.forEach((i) => {
123
+ var t;
124
+ let a = i;
125
+ U.value.srcAt && (a = (i == null ? void 0 : i[U.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
126
+ }), j());
86
127
  });
87
- }, r = u({
128
+ }, p = h({
88
129
  dialogVisible: !1,
89
130
  formData: {
90
131
  // 名称
@@ -93,112 +134,83 @@ 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
+ }), $ = h(), I = () => {
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
+ }, ee = () => {
147
+ var e;
148
+ (e = $.value) == null || e.validate((o) => {
149
+ var i, a;
150
+ o && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${p.value.formData.name}" data-poster="${p.value.formData.cover[0]}" src="${(i = p.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), I());
151
+ });
152
+ }, g = h({
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
+ }), E = h(), q = () => {
161
+ g.value.dialogVisible = !1, g.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
+ }, g.value.additionalData = {};
164
+ }, ae = () => {
165
+ var e;
166
+ (e = E.value) == null || e.validate((o) => {
167
+ var i, a;
168
+ o && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(i = g.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), q());
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);
149
- if (!l.success) {
150
- e(), setTimeout(() => {
151
- n.onError(l.errorMessage);
170
+ }, te = (e, o) => new Promise(async (i, a) => {
171
+ var l, r;
172
+ const t = await K(e);
173
+ if (!t.success) {
174
+ a(), setTimeout(() => {
175
+ o.onError(t.errorMessage);
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) {
157
- e(), setTimeout(() => {
158
- n.onError(s.errorMessage);
179
+ const n = await ((r = (l = c.value).handleRequest) == null ? void 0 : r.call(l, t.file, e.name, { extParameters: u.extParameters }));
180
+ if (!n || !(n != null && n.success)) {
181
+ a(), setTimeout(() => {
182
+ o.onError(n == null ? void 0 : n.errorMessage);
159
183
  });
160
184
  return;
161
185
  }
162
- i(s.url);
186
+ i(n.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 F(e) {
189
+ var i, a, t, n;
190
+ const o = e.getElementsByTagName("img");
191
+ for (let l of o) {
192
+ const r = l.src;
193
+ if (r.startsWith("http://") || r.startsWith("https://")) {
194
+ const s = await be(r);
195
+ if (s && (s.width < (c.value.minWidth || 0) && s.height < (c.value.minHeight || 0) || s.width > (c.value.maxWidth || 0) && s.height > (c.value.maxHeight || 0))) {
196
+ (i = l == null ? void 0 : l.remove) == null || i.call(l);
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 = ye(r);
200
+ if (!((t = (a = c.value) == null ? void 0 : a.allowedType) != null && t.includes(d.toLowerCase()))) {
201
+ (n = l == null ? void 0 : l.remove) == null || n.call(l);
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(() => {
197
- const t = {
207
+ ge(() => {
208
+ var i;
209
+ const e = {
198
210
  // 设置语言
199
211
  language: "zh_CN",
200
212
  // 实例
201
- target: z.value,
213
+ target: R.value,
202
214
  // 隐藏品牌
203
215
  branding: !1,
204
216
  // 隐藏右上角升级按钮
@@ -253,12 +265,13 @@ const Qe = /* @__PURE__ */ ne({
253
265
  ],
254
266
  menu: {
255
267
  insert: {
256
- title: "菜单",
268
+ title: "插入",
257
269
  items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
258
270
  }
259
271
  },
272
+ toolbar_mode: "sliding",
260
273
  // 工具栏
261
- toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
274
+ 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
275
  // 改动后刷新,不再弹 alert
263
276
  autosave_ask_before_unload: !1,
264
277
  // 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
@@ -272,161 +285,200 @@ const Qe = /* @__PURE__ */ ne({
272
285
  convert_urls: !1,
273
286
  paste_webkit_styles: "all",
274
287
  paste_data_images: !0,
288
+ images_file_types: ((i = c.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
275
289
  // 粘贴前处理
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);
290
+ paste_preprocess(a, t) {
291
+ t.content = t.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), t.content = t.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), t.content = t.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), t.content = t.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), t.content = t.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), t.content = t.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), t.content = t.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), t.content = t.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), t.content = t.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), t.content = t.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
279
292
  },
280
293
  // 粘贴后处理(处理异步操作)
281
- paste_postprocess(i, e) {
282
- var l;
283
- const o = e.node;
284
- $(o), (l = T.value) == null || l.call(T, i, e);
294
+ paste_postprocess(a, t) {
295
+ F(t.node);
285
296
  },
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
297
+ images_upload_handler(a) {
298
+ return new Promise(async (t, n) => {
299
+ var N, O, G;
300
+ if (!((N = c.value) != null && N.handleRequest))
301
+ return n({ message: "缺少图片上传配置", remove: !0 });
302
+ const l = k.service({ text: "上传中" });
303
+ let r = a.blob(), s = r.name ? r.name : a.filename();
304
+ if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
305
+ return l == null || l.close(), n({ message: "不允许粘贴", remove: !0 });
306
+ const d = await xe(r, s, {
307
+ imageMaxSize: c.value.maxSize,
308
+ imageAllowedType: c.value.allowedType,
309
+ // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
310
+ imageMinWidth: c.value.minWidth,
311
+ imageMinHeight: c.value.minHeight,
312
+ imageMaxWidth: c.value.maxWidth,
313
+ imageMaxHeight: c.value.maxHeight
298
314
  });
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 });
315
+ if (!d.success)
316
+ return l == null || l.close(), n({ message: (d == null ? void 0 : d.errorMessage) || "", remove: !0 });
317
+ if (d.hasTransform) {
318
+ r = d.file;
319
+ const L = s == null ? void 0 : s.split(".");
320
+ L.pop(), s = `${L.join(",")}.jpeg`;
306
321
  }
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);
322
+ const v = await K(r);
323
+ if (!v.success)
324
+ return l == null || l.close(), n({ message: v == null ? void 0 : v.errorMessage, remove: !0 });
325
+ const y = await ((G = (O = c.value).handleRequest) == null ? void 0 : G.call(O, v.file, s, { extParameters: u.extParameters }));
326
+ if (!y || !y.success)
327
+ return l == null || l.close(), n({ message: y.errorMessage, remove: !0 });
328
+ l == null || l.close(), t(y.url);
316
329
  });
317
330
  },
318
- setup(i) {
319
- i.ui.registry.addMenuItem("localImage", {
331
+ setup(a) {
332
+ var n, l;
333
+ const t = () => {
334
+ _.value.dialogVisible = !0, setTimeout(() => {
335
+ var s, d;
336
+ const r = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
337
+ r && (r.innerHTML = ((d = c.value) == null ? void 0 : d.tipText) || "上传");
338
+ });
339
+ };
340
+ if (a.ui.registry.addMenuItem("localImage", {
320
341
  text: "图片",
321
342
  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 || "上传");
343
+ onAction: () => t()
344
+ }), a.ui.registry.addButton("localImage", {
345
+ icon: "image",
346
+ tooltip: "图片",
347
+ onAction: () => t()
348
+ }), (n = f == null ? void 0 : f.value) != null && n.enable) {
349
+ const r = () => {
350
+ p.value.dialogVisible = !0, setTimeout(() => {
351
+ var d, v;
352
+ const s = (d = document == null ? void 0 : document.querySelector) == null ? void 0 : d.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
353
+ s && (s.innerHTML = ((v = c.value) == null ? void 0 : v.tipText) || "上传");
337
354
  });
338
- }
339
- }), i.ui.registry.addMenuItem("localVideo", {
340
- text: "视频",
341
- icon: "embed",
342
- onAction: () => {
343
- d.value.dialogVisible = !0;
344
- }
345
- });
355
+ };
356
+ a.ui.registry.addMenuItem("localAudio", {
357
+ text: "音频",
358
+ icon: "arrow-right",
359
+ onAction: () => r()
360
+ }), a.ui.registry.addButton("localAudio", {
361
+ icon: "arrow-right",
362
+ tooltip: "音频",
363
+ onAction: () => r()
364
+ });
365
+ }
366
+ if ((l = m == null ? void 0 : m.value) != null && l.enable) {
367
+ const r = () => {
368
+ g.value.dialogVisible = !0;
369
+ };
370
+ a.ui.registry.addMenuItem("localVideo", {
371
+ text: "视频",
372
+ icon: "embed",
373
+ onAction: () => r()
374
+ }), a.ui.registry.addButton("localVideo", {
375
+ icon: "embed",
376
+ tooltip: "视频",
377
+ onAction: () => r()
378
+ });
379
+ }
346
380
  }
347
- }, n = M(
381
+ }, o = A(
348
382
  [
349
- a.options,
350
- x.tinymceOptions,
351
- t
383
+ u.options,
384
+ C.options,
385
+ e
352
386
  ],
353
387
  {
354
- mergeFunction: (i, e) => (...o) => {
355
- i(...o), e(...o);
388
+ mergeFunction: (a, t) => (...n) => {
389
+ a(...n), t(...n);
356
390
  },
357
391
  type: Object
358
392
  }
359
393
  );
360
- B.init(n).then(([i]) => {
361
- var e;
362
- i && (i.customProps = { ...a }, i.on("change input Redo Undo SetContent", () => {
363
- if (w.value) {
364
- w.value = !1;
394
+ Q.init(o).then(([a]) => {
395
+ var t;
396
+ a && (a.customProps = { ...u }, a.on("change input Redo Undo SetContent", () => {
397
+ if (T.value) {
398
+ T.value = !1;
365
399
  return;
366
400
  }
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);
401
+ P.value = !0, z("input", a.getContent());
402
+ }), (t = u.initComplete) == null || t.call(u, { editorIns: a }), x.value = a);
369
403
  });
404
+ }), he(() => {
405
+ var e;
406
+ (e = x.value) == null || e.destroy();
370
407
  });
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();
408
+ const oe = () => {
409
+ var o, i;
410
+ const e = { ...p.value.additionalData || {} };
411
+ return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
412
+ }, ie = () => {
413
+ var o, i;
414
+ const e = { ...p.value.additionalData || {} };
415
+ return ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
416
+ }, le = (e, o, i) => {
417
+ var t, n;
418
+ const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
419
+ a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), p.value.formData.file = i;
420
+ }, ne = (e, o) => new Promise((i, a) => {
421
+ var n, l, r, s, d, v;
422
+ const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
423
+ if (!((l = (n = f.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
424
+ b.error(`请上传格式为${(s = (r = f.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
379
425
  return;
380
426
  }
381
- if (t.size > a.audioMaxSize * 1024 * 1024) {
382
- f.info(`请上传${a.audioMaxSize}M内的音频`), e();
427
+ if (e.size > (((d = f.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
428
+ b.error(`请上传${((v = f.value) == null ? void 0 : v.maxSize) || 0}M内的音频`), a();
383
429
  return;
384
430
  }
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();
431
+ p.value.additionalData = { file: e }, i(!0);
432
+ }), re = (e, o) => {
433
+ p.value.formData.file = o;
434
+ }, se = (e, o, i) => {
435
+ b.error("上传发生错误,请重试!"), p.value.formData.file = i;
436
+ }, ue = () => {
437
+ var o, i;
438
+ const e = { ...g.value.additionalData || {} };
439
+ return ((i = (o = m.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
440
+ }, ce = () => {
441
+ var o, i;
442
+ const e = { ...g.value.additionalData || {} };
443
+ return ((i = (o = m.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: u.extParameters })) || {};
444
+ }, me = (e, o, i) => {
445
+ var t, n;
446
+ const a = (n = (t = m == null ? void 0 : m.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
447
+ a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), g.value.formData.file = i;
448
+ }, de = (e, o) => new Promise((i, a) => {
449
+ var n, l, r, s, d, v;
450
+ const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
451
+ if (!((l = (n = m == null ? void 0 : m.value) == null ? void 0 : n.allowedType) != null && l.includes(t.toLowerCase()))) {
452
+ b.error(`请上传格式为${(s = (r = m == null ? void 0 : m.value) == null ? void 0 : r.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
398
453
  return;
399
454
  }
400
- if (t.size > a.videoMaxSize * 1024 * 1024) {
401
- f.info(`请上传${a.videoMaxSize}M内的视频`), e();
455
+ if (e.size > (((d = m == null ? void 0 : m.value) == null ? void 0 : d.maxSize) || 0) * 1024 * 1024) {
456
+ b.error(`请上传${((v = m == null ? void 0 : m.value) == null ? void 0 : v.maxSize) || 0}M内的视频`), a();
402
457
  return;
403
458
  }
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;
459
+ g.value.additionalData = { file: e }, i(!0);
460
+ }), pe = (e, o) => {
461
+ g.value.formData.file = o;
462
+ }, ve = (e, o, i) => {
463
+ b.error("上传发生错误,请重试!"), g.value.formData.file = i;
409
464
  };
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],
465
+ return S(() => [u.disabled, x.value], () => {
466
+ var e, o;
467
+ (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(u.disabled ? "readonly" : "design");
468
+ }, { immediate: !0 }), S(
469
+ () => [u.value, x.value],
418
470
  () => {
419
- var t;
420
- if (_.value) {
421
- _.value = !1;
471
+ var e;
472
+ if (P.value) {
473
+ P.value = !1;
422
474
  return;
423
475
  }
424
- w.value = !0, (t = m.value) == null || t.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
476
+ T.value = !0, (e = x.value) == null || e.setContent(u.value ? u.value : "");
425
477
  },
426
478
  { 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 };
479
+ ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef: x, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: c, mergeVideoUploadOptions: m, mergeAudioUploadOptions: f, mergeImgPondOptions: U, imgPondAccept: Y, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: _, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: Z, uploadAudio: p, uploadAudioFormRef: $, onUploadAudioClose: I, onUploadAudioConfirm: ee, uploadVideo: g, uploadVideoFormRef: E, onUploadVideoClose: q, onUploadVideoConfirm: ae, onImageUploadUpload: te, processPastedImage: F, getUploadAudioData: oe, getUploadAudioHeaders: ie, onUploadAudioSuccess: le, onUploadAudioBeforeUpload: ne, onUploadAudioRemove: re, onUploadAudioError: se, getUploadVideoData: ue, getUploadVideoHeaders: ce, onUploadVideoSuccess: me, onUploadVideoBeforeUpload: de, onUploadVideoRemove: pe, onUploadVideoError: ve, ImgPond: _e };
428
480
  }
429
481
  });
430
482
  export {
431
- Qe as default
483
+ ra as default
432
484
  };