@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/README.md +116 -108
- package/es/editor.vue.d.ts +25 -219
- package/es/editor.vue.js +18 -18
- package/es/editor.vue2.js +261 -280
- package/es/index.d.ts +85 -805
- package/es/index.js +7 -6
- package/es/types.d.ts +79 -0
- package/es/util.d.ts +6 -1
- package/es/util.js +14 -7
- package/package.json +2 -2
- package/src/index.ts +14 -30
package/es/editor.vue2.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImgPondBeforeAddFile as
|
|
3
|
-
import { getImagePixel as
|
|
4
|
-
import
|
|
5
|
-
import { conclude as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
|
37
|
-
import { Loading as
|
|
38
|
-
const
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
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"
|
|
70
|
-
setup(
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
82
|
+
t = k.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading" });
|
|
80
83
|
},
|
|
81
84
|
onSuccess: () => {
|
|
82
|
-
|
|
85
|
+
t == null || t.close();
|
|
83
86
|
},
|
|
84
|
-
onError: (
|
|
85
|
-
|
|
87
|
+
onError: (o) => {
|
|
88
|
+
t == null || t.close(), b.error(o);
|
|
86
89
|
}
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
92
|
}, { immediate: !0 });
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
let
|
|
94
|
-
|
|
93
|
+
const M = g();
|
|
94
|
+
S(() => M.value, () => {
|
|
95
|
+
if (M.value) {
|
|
96
|
+
let t;
|
|
97
|
+
L(M.value, {
|
|
95
98
|
onStart: () => {
|
|
96
|
-
|
|
99
|
+
t = k.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading" });
|
|
97
100
|
},
|
|
98
101
|
onSuccess: () => {
|
|
99
|
-
|
|
102
|
+
t == null || t.close();
|
|
100
103
|
},
|
|
101
|
-
onError: (
|
|
102
|
-
|
|
104
|
+
onError: (o) => {
|
|
105
|
+
t == null || t.close(), b.error(o);
|
|
103
106
|
}
|
|
104
107
|
});
|
|
105
108
|
}
|
|
106
109
|
}, { immediate: !0 });
|
|
107
|
-
const
|
|
110
|
+
const _ = g({
|
|
108
111
|
dialogVisible: !1,
|
|
109
112
|
formData: {
|
|
110
113
|
images: []
|
|
111
114
|
}
|
|
112
|
-
}),
|
|
113
|
-
|
|
115
|
+
}), I = g(), W = () => {
|
|
116
|
+
_.value.dialogVisible = !1, _.value.formData = {
|
|
114
117
|
images: []
|
|
115
118
|
};
|
|
116
|
-
},
|
|
117
|
-
var
|
|
118
|
-
(
|
|
119
|
-
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
},
|
|
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
|
-
}),
|
|
139
|
-
|
|
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
|
-
},
|
|
154
|
-
},
|
|
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
|
-
}),
|
|
163
|
-
|
|
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
|
-
},
|
|
174
|
-
},
|
|
175
|
-
var
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
175
|
+
o.onError(l.errorMessage);
|
|
180
176
|
});
|
|
181
177
|
return;
|
|
182
178
|
}
|
|
183
|
-
const
|
|
184
|
-
if (!
|
|
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
|
-
|
|
182
|
+
o.onError(i == null ? void 0 : i.errorMessage);
|
|
187
183
|
});
|
|
188
184
|
return;
|
|
189
185
|
}
|
|
190
|
-
|
|
191
|
-
})
|
|
192
|
-
async function
|
|
193
|
-
var
|
|
194
|
-
const
|
|
195
|
-
for (let
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
(
|
|
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
|
|
204
|
-
if (!
|
|
205
|
-
(
|
|
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
|
-
|
|
212
|
-
|
|
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:
|
|
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(
|
|
306
|
-
|
|
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(
|
|
311
|
-
|
|
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(
|
|
316
|
-
return new Promise(async (e,
|
|
317
|
-
var
|
|
318
|
-
if (!
|
|
319
|
-
return
|
|
320
|
-
const
|
|
321
|
-
let
|
|
322
|
-
const
|
|
323
|
-
imageMaxSize:
|
|
324
|
-
imageAllowedType:
|
|
325
|
-
imageAllowedMineType:
|
|
326
|
-
imageMinWidth:
|
|
327
|
-
imageMinHeight:
|
|
328
|
-
imageMaxWidth:
|
|
329
|
-
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 (
|
|
332
|
-
const
|
|
333
|
-
|
|
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
|
|
336
|
-
if (!
|
|
337
|
-
return
|
|
338
|
-
const
|
|
339
|
-
if (!
|
|
340
|
-
return
|
|
341
|
-
|
|
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(
|
|
345
|
-
|
|
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
|
-
|
|
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
|
|
361
|
-
const
|
|
362
|
-
|
|
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
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
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
|
-
},
|
|
374
|
+
}, o = A(
|
|
400
375
|
[
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
376
|
+
u.options,
|
|
377
|
+
C.options,
|
|
378
|
+
t
|
|
404
379
|
],
|
|
405
380
|
{
|
|
406
|
-
mergeFunction: (
|
|
407
|
-
|
|
381
|
+
mergeFunction: (a, e) => (...l) => {
|
|
382
|
+
a(...l), e(...l);
|
|
408
383
|
},
|
|
409
384
|
type: Object
|
|
410
385
|
}
|
|
411
386
|
);
|
|
412
|
-
|
|
387
|
+
K.init(o).then(([a]) => {
|
|
413
388
|
var e;
|
|
414
|
-
|
|
415
|
-
if (
|
|
416
|
-
|
|
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
|
-
|
|
420
|
-
}), (e =
|
|
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
|
|
424
|
-
var
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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 (
|
|
440
|
-
|
|
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
|
-
|
|
444
|
-
}),
|
|
445
|
-
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
},
|
|
449
|
-
var
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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 (
|
|
465
|
-
|
|
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
|
-
|
|
469
|
-
}), de = (
|
|
470
|
-
|
|
471
|
-
},
|
|
472
|
-
|
|
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
|
|
475
|
-
var
|
|
476
|
-
(
|
|
477
|
-
}
|
|
478
|
-
|
|
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
|
|
484
|
-
if (
|
|
485
|
-
|
|
464
|
+
var t;
|
|
465
|
+
if (P.value) {
|
|
466
|
+
P.value = !1;
|
|
486
467
|
return;
|
|
487
468
|
}
|
|
488
|
-
|
|
469
|
+
T.value = !0, (t = h.value) == null || t.setContent(u.value ? u.value : "");
|
|
489
470
|
},
|
|
490
471
|
{ immediate: !0 }
|
|
491
|
-
), { __sfc: !0,
|
|
472
|
+
), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: u, emits: z, insRef: R, editorRef: h, preventSettingContent: P, preventUpdatingModelValue: T, mergeImageUploadOptions: m, mergeVideoUploadOptions: c, mergeAudioUploadOptions: v, mergeImgPondOptions: U, imgPondAccept: X, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: _, uploadImageFormRef: I, onUploadImageClose: W, onUploadImageConfirm: Y, uploadAudio: p, uploadAudioFormRef: $, onUploadAudioClose: E, onUploadAudioConfirm: Z, uploadVideo: f, uploadVideoFormRef: q, onUploadVideoClose: F, onUploadVideoConfirm: ee, onImageUploadUpload: ae, processPastedImage: N, getUploadAudioData: te, getUploadAudioHeaders: oe, onUploadAudioSuccess: ie, onUploadAudioBeforeUpload: le, onUploadAudioRemove: ne, onUploadAudioError: re, getUploadVideoData: se, getUploadVideoHeaders: ue, onUploadVideoSuccess: ce, onUploadVideoBeforeUpload: me, onUploadVideoRemove: de, onUploadVideoError: pe, ImgPond: ye };
|
|
492
473
|
}
|
|
493
474
|
});
|
|
494
475
|
export {
|
|
495
|
-
|
|
476
|
+
na as default
|
|
496
477
|
};
|