@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/README.md +159 -68
- package/es/editor.vue.d.ts +25 -181
- package/es/editor.vue.js +18 -18
- package/es/editor.vue2.js +297 -245
- package/es/index.d.ts +85 -669
- package/es/index.js +10 -11
- package/es/style.css +1 -1
- package/es/types.d.ts +79 -0
- package/es/util.d.ts +6 -32
- package/es/util.js +13 -70
- package/package.json +3 -4
- package/src/index.ts +16 -31
package/es/editor.vue2.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
36
|
-
import { Loading as
|
|
37
|
-
const
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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"
|
|
67
|
-
setup(
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
const
|
|
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
|
-
}),
|
|
76
|
-
|
|
115
|
+
}), W = h(), j = () => {
|
|
116
|
+
_.value.dialogVisible = !1, _.value.formData = {
|
|
77
117
|
images: []
|
|
78
118
|
};
|
|
79
|
-
},
|
|
80
|
-
var
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
},
|
|
132
|
-
var
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
|
156
|
-
if (!
|
|
157
|
-
|
|
158
|
-
|
|
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(
|
|
186
|
+
i(n.url);
|
|
163
187
|
});
|
|
164
|
-
async function
|
|
165
|
-
var i,
|
|
166
|
-
const
|
|
167
|
-
for (let
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
const s = await
|
|
171
|
-
if (s.width <
|
|
172
|
-
(i =
|
|
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
|
|
176
|
-
if (!a.
|
|
177
|
-
(
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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:
|
|
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(
|
|
277
|
-
|
|
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(
|
|
282
|
-
|
|
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(
|
|
287
|
-
return new Promise(async (
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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 (!
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
|
308
|
-
if (!
|
|
309
|
-
return l == null || l.close(),
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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(
|
|
319
|
-
|
|
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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
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
|
-
},
|
|
381
|
+
}, o = A(
|
|
348
382
|
[
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
383
|
+
u.options,
|
|
384
|
+
C.options,
|
|
385
|
+
e
|
|
352
386
|
],
|
|
353
387
|
{
|
|
354
|
-
mergeFunction: (
|
|
355
|
-
|
|
388
|
+
mergeFunction: (a, t) => (...n) => {
|
|
389
|
+
a(...n), t(...n);
|
|
356
390
|
},
|
|
357
391
|
type: Object
|
|
358
392
|
}
|
|
359
393
|
);
|
|
360
|
-
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
if (
|
|
364
|
-
|
|
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
|
-
|
|
368
|
-
}), (
|
|
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
|
|
372
|
-
var o,
|
|
373
|
-
const e =
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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 (
|
|
382
|
-
|
|
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
|
-
}),
|
|
387
|
-
|
|
388
|
-
},
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
var o,
|
|
392
|
-
const e =
|
|
393
|
-
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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 (
|
|
401
|
-
|
|
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
|
-
}),
|
|
406
|
-
|
|
407
|
-
},
|
|
408
|
-
|
|
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
|
|
411
|
-
var
|
|
412
|
-
(
|
|
413
|
-
}
|
|
414
|
-
|
|
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
|
|
420
|
-
if (
|
|
421
|
-
|
|
471
|
+
var e;
|
|
472
|
+
if (P.value) {
|
|
473
|
+
P.value = !1;
|
|
422
474
|
return;
|
|
423
475
|
}
|
|
424
|
-
|
|
476
|
+
T.value = !0, (e = x.value) == null || e.setContent(u.value ? u.value : "");
|
|
425
477
|
},
|
|
426
478
|
{ immediate: !0 }
|
|
427
|
-
), { __sfc: !0,
|
|
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
|
-
|
|
483
|
+
ra as default
|
|
432
484
|
};
|