@keyblade/tinymce-editor-vue2 0.0.11 → 0.0.12-alpha.11
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 +161 -38
- package/es/editor.vue.d.ts +127 -3
- package/es/editor.vue.js +18 -11
- package/es/editor.vue2.js +332 -126
- package/es/index.d.ts +543 -86
- package/es/index.js +11 -6
- package/es/style.css +1 -1
- package/es/util.d.ts +41 -0
- package/es/util.js +77 -0
- package/package.json +6 -3
- package/src/index.ts +35 -12
package/es/editor.vue2.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import q from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as ce, ref as m, computed as M, onMounted as ge, onUnmounted as fe, watch as F } from "vue";
|
|
2
|
+
import { oneTravelImageCheck as N, oneTravelImageCompressor as q, getImagePixel as ve } from "./util.js";
|
|
3
|
+
import he from "imgpond";
|
|
4
|
+
import { conclude as x } from "vue-global-config";
|
|
5
|
+
import j from "tinymce";
|
|
6
|
+
import Me from "./langs/zh_CN.js";
|
|
6
7
|
import "tinymce/skins/ui/oxide/skin";
|
|
7
8
|
import "tinymce/models/dom";
|
|
8
9
|
import "tinymce/themes/silver";
|
|
@@ -31,14 +32,17 @@ import "tinymce/plugins/table";
|
|
|
31
32
|
import "tinymce/plugins/visualblocks";
|
|
32
33
|
import "tinymce/plugins/visualchars";
|
|
33
34
|
import "tinymce/plugins/wordcount";
|
|
34
|
-
import { globalProps as
|
|
35
|
-
|
|
35
|
+
import { globalProps as b } from "./index.js";
|
|
36
|
+
import { Loading as xe, Message as h } from "element-ui";
|
|
37
|
+
const ia = /* @__PURE__ */ ce({
|
|
36
38
|
__name: "editor",
|
|
37
39
|
props: {
|
|
38
40
|
value: { default: "" },
|
|
39
41
|
modelValue: { default: "" },
|
|
40
42
|
disabled: { type: Boolean },
|
|
41
43
|
extParameters: null,
|
|
44
|
+
imageUploadMaxCount: { default: 2 },
|
|
45
|
+
imageUploadTip: { default: "上传" },
|
|
42
46
|
imageMaxSize: { default: 30 },
|
|
43
47
|
imageAllowedType: { default: () => ["jpg", "jpeg", "png", "bmp", "heif", "gif", "webp"] },
|
|
44
48
|
imageAllowedMineType: { default: () => ["image/jpg", "image/jpeg", "image/png", "image/bmp", "image/heif", "image/heic", "image/gif", "image/webp"] },
|
|
@@ -46,84 +50,165 @@ const ze = /* @__PURE__ */ N({
|
|
|
46
50
|
imageMinHeight: { default: 60 },
|
|
47
51
|
imageMaxWidth: { default: 6e3 },
|
|
48
52
|
imageMaxHeight: { default: 6e3 },
|
|
53
|
+
audioEnable: { type: Boolean, default: !0 },
|
|
54
|
+
audioMaxSize: { default: 200 },
|
|
55
|
+
audioAllowedType: { default: () => ["MP3", "M4A", "WAV", "AAC"] },
|
|
56
|
+
audioUploadOptions: null,
|
|
57
|
+
videoEnable: { type: Boolean, default: !0 },
|
|
58
|
+
videoMaxSize: { default: 300 },
|
|
59
|
+
videoAllowedType: { default: () => ["MP4", "3GP"] },
|
|
60
|
+
videoUploadOptions: null,
|
|
49
61
|
imageUploadHandle: null,
|
|
50
62
|
paste_preprocess: null,
|
|
51
63
|
paste_postprocess: null,
|
|
52
64
|
initComplete: null,
|
|
53
|
-
options: { default: () => ({}) }
|
|
65
|
+
options: { default: () => ({}) },
|
|
66
|
+
imgPondOptions: null
|
|
54
67
|
},
|
|
55
68
|
emits: ["input", "update:modelValue"],
|
|
56
|
-
setup(
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
setup(G, { emit: S }) {
|
|
70
|
+
const a = G;
|
|
71
|
+
j.addI18n("zh_CN", Me);
|
|
72
|
+
const k = m(), d = m(), U = m(!1), V = m(!1), g = m({
|
|
73
|
+
dialogVisible: !1,
|
|
74
|
+
formData: {
|
|
75
|
+
images: []
|
|
76
|
+
}
|
|
77
|
+
}), z = m(), L = () => {
|
|
78
|
+
g.value.dialogVisible = !1, g.value.formData = {
|
|
79
|
+
images: []
|
|
80
|
+
};
|
|
81
|
+
}, J = () => {
|
|
82
|
+
var i;
|
|
83
|
+
(i = z.value) == null || i.validate((l) => {
|
|
84
|
+
l && (g.value.formData.images.forEach((o) => {
|
|
85
|
+
var e, t;
|
|
86
|
+
if ($.value.srcAt)
|
|
87
|
+
return (e = d.value) == null ? void 0 : e.insertContent(`<img src=${o == null ? void 0 : o[$.value.srcAt]} alt="" />`);
|
|
88
|
+
(t = d.value) == null || t.insertContent(`<img src=${o} alt="" />`);
|
|
89
|
+
}), g.value.dialogVisible = !1, g.value.formData.images = []);
|
|
90
|
+
});
|
|
91
|
+
}, r = m({
|
|
92
|
+
dialogVisible: !1,
|
|
93
|
+
formData: {
|
|
94
|
+
// 名称
|
|
95
|
+
name: "",
|
|
96
|
+
// 封面
|
|
97
|
+
cover: [],
|
|
98
|
+
// 文件
|
|
99
|
+
file: []
|
|
100
|
+
},
|
|
101
|
+
// 用于临时保存上传前的参数 { file: File }
|
|
102
|
+
additionalData: {}
|
|
103
|
+
}), H = m(), K = () => {
|
|
104
|
+
var i;
|
|
105
|
+
(i = H.value) == null || i.validate((l) => {
|
|
106
|
+
var o, e;
|
|
107
|
+
l && ((e = d.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 = {
|
|
108
|
+
name: "",
|
|
109
|
+
cover: [],
|
|
110
|
+
file: []
|
|
111
|
+
}, r.value.additionalData = {});
|
|
112
|
+
});
|
|
113
|
+
}, Q = () => {
|
|
114
|
+
r.value.dialogVisible = !1, r.value.formData = {
|
|
115
|
+
name: "",
|
|
116
|
+
cover: [],
|
|
117
|
+
file: []
|
|
118
|
+
}, r.value.additionalData = {};
|
|
119
|
+
}, s = m({
|
|
120
|
+
dialogVisible: !1,
|
|
121
|
+
formData: {
|
|
122
|
+
// 文件
|
|
123
|
+
file: []
|
|
124
|
+
},
|
|
125
|
+
// 用于临时保存上传前的参数 { file: File }
|
|
126
|
+
additionalData: {}
|
|
127
|
+
}), W = m(), X = () => {
|
|
128
|
+
var i;
|
|
129
|
+
(i = W.value) == null || i.validate((l) => {
|
|
130
|
+
var o, e;
|
|
131
|
+
l && ((e = d.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 = {
|
|
132
|
+
file: []
|
|
133
|
+
}, s.value.additionalData = {});
|
|
134
|
+
});
|
|
135
|
+
}, Y = () => {
|
|
136
|
+
s.value.dialogVisible = !1, s.value.formData = {
|
|
137
|
+
file: []
|
|
138
|
+
}, s.value.additionalData = {};
|
|
139
|
+
}, Z = (i, l) => new Promise(async (o, e) => {
|
|
140
|
+
var p, c;
|
|
141
|
+
const t = await N(i, {
|
|
142
|
+
imageMaxSize: a.imageMaxSize,
|
|
143
|
+
imageAllowedMineType: a.imageAllowedMineType,
|
|
144
|
+
imageMinWidth: a.imageMinWidth,
|
|
145
|
+
imageMinHeight: a.imageMinHeight,
|
|
146
|
+
imageMaxWidth: a.imageMaxWidth,
|
|
147
|
+
imageMaxHeight: a.imageMaxHeight
|
|
148
|
+
});
|
|
149
|
+
if (!t.success) {
|
|
150
|
+
e(), setTimeout(() => {
|
|
151
|
+
var w, A, T;
|
|
152
|
+
(w = t.error) != null && w.size ? l.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (A = t.error) != null && A.format ? l.onError(`请上传格式为${a.imageAllowedType.map((P) => P.toUpperCase()).join("、")}的图片`) : (T = t.error) != null && T.pixel && l.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
|
|
153
|
+
});
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const n = await q(i);
|
|
157
|
+
if (!n.success) {
|
|
158
|
+
e(), setTimeout(() => {
|
|
159
|
+
l.onError(n.errorMessage);
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
let u = i.name;
|
|
164
|
+
n.hasConversion && (u = `${(p = u.split(".")) == null ? void 0 : p[0]}.jpeg`);
|
|
165
|
+
const v = await ((c = f.value) == null ? void 0 : c.call(f, n.file, u, { extParameters: a.extParameters }));
|
|
166
|
+
if (!v.success) {
|
|
167
|
+
e(), setTimeout(() => {
|
|
168
|
+
l.onError(v.errorMessage);
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
o(v.url);
|
|
173
|
+
}), ee = M(() => a.imageAllowedMineType.map((i) => `.${i.split("/")[1]}`).join(",") || "");
|
|
174
|
+
async function B(i) {
|
|
175
|
+
var o, e;
|
|
176
|
+
const l = i.getElementsByTagName("img");
|
|
177
|
+
for (let t of l) {
|
|
178
|
+
const n = t.src;
|
|
179
|
+
if (n.startsWith("http://") || n.startsWith("https://")) {
|
|
180
|
+
const u = await ve(n);
|
|
181
|
+
if (u.width < a.imageMinWidth && u.height < a.imageMinHeight || u.width > a.imageMaxWidth && u.height > a.imageMaxHeight) {
|
|
182
|
+
(o = t == null ? void 0 : t.remove) == null || o.call(t);
|
|
69
183
|
return;
|
|
70
184
|
}
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
73
|
-
(e =
|
|
185
|
+
const v = n.split("."), p = v[v.length - 1].toLowerCase();
|
|
186
|
+
if (!a.imageAllowedType.includes(p)) {
|
|
187
|
+
(e = t == null ? void 0 : t.remove) == null || e.call(t);
|
|
74
188
|
return;
|
|
75
189
|
}
|
|
76
190
|
}
|
|
77
191
|
}
|
|
78
192
|
}
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
let o = e.length;
|
|
82
|
-
const i = new Uint8Array(o);
|
|
83
|
-
for (; o--; )
|
|
84
|
-
i[o] = e.charCodeAt(o);
|
|
85
|
-
return new Blob([i], { type: a });
|
|
86
|
-
};
|
|
87
|
-
function M(n) {
|
|
88
|
-
return new Promise((s) => {
|
|
89
|
-
const a = new Image();
|
|
90
|
-
a.onload = function() {
|
|
91
|
-
s({ width: a.width, height: a.height, image: a });
|
|
92
|
-
}, a.src = n;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function A(n, s) {
|
|
96
|
-
return new Promise((a) => {
|
|
97
|
-
new q(n, {
|
|
98
|
-
...s,
|
|
99
|
-
success: async (e) => {
|
|
100
|
-
a({ success: !0, file: e });
|
|
101
|
-
},
|
|
102
|
-
error(e) {
|
|
103
|
-
a({ success: !1, error: e });
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
const h = k(
|
|
109
|
-
() => _([t.paste_preprocess, d.paste_preprocess], {
|
|
193
|
+
const y = M(() => x([a.videoUploadOptions, b.videoUploadOptions]) || {}), _ = M(() => x([a.audioUploadOptions, b.audioUploadOptions]) || {}), $ = M(() => x([a.imgPondOptions, b.imgPondOptions]) || {}), C = M(
|
|
194
|
+
() => x([a.paste_preprocess, b.paste_preprocess], {
|
|
110
195
|
type: Function
|
|
111
196
|
})
|
|
112
|
-
),
|
|
113
|
-
() =>
|
|
197
|
+
), D = M(
|
|
198
|
+
() => x([a.paste_postprocess, b.paste_postprocess], {
|
|
114
199
|
type: Function
|
|
115
200
|
})
|
|
116
|
-
),
|
|
117
|
-
() =>
|
|
201
|
+
), f = M(
|
|
202
|
+
() => x([a.imageUploadHandle, b.imageUploadHandle], {
|
|
118
203
|
type: Function
|
|
119
204
|
})
|
|
120
205
|
);
|
|
121
|
-
|
|
122
|
-
const
|
|
206
|
+
ge(() => {
|
|
207
|
+
const i = {
|
|
123
208
|
// 设置语言
|
|
124
209
|
language: "zh_CN",
|
|
125
210
|
// 实例
|
|
126
|
-
target:
|
|
211
|
+
target: k.value,
|
|
127
212
|
// 隐藏品牌
|
|
128
213
|
branding: !1,
|
|
129
214
|
// 隐藏右上角升级按钮
|
|
@@ -140,6 +225,10 @@ const ze = /* @__PURE__ */ N({
|
|
|
140
225
|
// - 小程序侧 web-view 中使用 iframe 需要配置业务域名
|
|
141
226
|
// - 给微信公众号 H5 侧带来授权问题
|
|
142
227
|
invalid_elements: "iframe,frame",
|
|
228
|
+
quickbars_insert_toolbar: !1,
|
|
229
|
+
autosave_restore_when_empty: !1,
|
|
230
|
+
image_advtab: !0,
|
|
231
|
+
image_caption: !0,
|
|
143
232
|
// 插件
|
|
144
233
|
plugins: [
|
|
145
234
|
"accordion",
|
|
@@ -172,12 +261,19 @@ const ze = /* @__PURE__ */ N({
|
|
|
172
261
|
"visualchars",
|
|
173
262
|
"wordcount"
|
|
174
263
|
],
|
|
264
|
+
menu: {
|
|
265
|
+
insert: {
|
|
266
|
+
title: "插入",
|
|
267
|
+
items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
toolbar_mode: "sliding",
|
|
175
271
|
// 工具栏
|
|
176
|
-
toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
|
|
272
|
+
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",
|
|
177
273
|
// 改动后刷新,不再弹 alert
|
|
178
274
|
autosave_ask_before_unload: !1,
|
|
179
|
-
// 内容样式
|
|
180
|
-
content_style:
|
|
275
|
+
// 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
|
|
276
|
+
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }div[data-mce-bogus="all"] .mce-object-audio { display: none }div[data-mce-bogus="all"] .mce-object-video { display: none }',
|
|
181
277
|
// 字体大小
|
|
182
278
|
font_size_formats: "8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px",
|
|
183
279
|
font_size_input_default_unit: "px",
|
|
@@ -188,90 +284,200 @@ const ze = /* @__PURE__ */ N({
|
|
|
188
284
|
paste_webkit_styles: "all",
|
|
189
285
|
paste_data_images: !0,
|
|
190
286
|
// 粘贴前处理
|
|
191
|
-
paste_preprocess(
|
|
192
|
-
var
|
|
193
|
-
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>"), (
|
|
287
|
+
paste_preprocess(o, e) {
|
|
288
|
+
var t;
|
|
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>"), (t = C.value) == null || t.call(C, o, e);
|
|
194
290
|
},
|
|
195
291
|
// 粘贴后处理(处理异步操作)
|
|
196
|
-
paste_postprocess(
|
|
197
|
-
var
|
|
198
|
-
const
|
|
199
|
-
|
|
292
|
+
paste_postprocess(o, e) {
|
|
293
|
+
var n;
|
|
294
|
+
const t = e.node;
|
|
295
|
+
B(t), (n = D.value) == null || n.call(D, o, e);
|
|
200
296
|
},
|
|
201
|
-
images_upload_handler(
|
|
202
|
-
return new Promise(async (e,
|
|
203
|
-
var
|
|
204
|
-
const
|
|
205
|
-
let
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (
|
|
220
|
-
|
|
221
|
-
else
|
|
222
|
-
return i == null || i.close(), o({ message: (V = c == null ? void 0 : c.error) == null ? void 0 : V.message, remove: !0 });
|
|
297
|
+
images_upload_handler(o) {
|
|
298
|
+
return new Promise(async (e, t) => {
|
|
299
|
+
var T, P, R, E, O;
|
|
300
|
+
const n = xe.service({ text: "上传中" });
|
|
301
|
+
let u = o.blob();
|
|
302
|
+
const v = o.filename(), p = await N(u, {
|
|
303
|
+
imageMaxSize: a.imageMaxSize,
|
|
304
|
+
imageAllowedMineType: a.imageAllowedMineType,
|
|
305
|
+
imageMinWidth: a.imageMinWidth,
|
|
306
|
+
imageMinHeight: a.imageMinHeight,
|
|
307
|
+
imageMaxWidth: a.imageMaxWidth,
|
|
308
|
+
imageMaxHeight: a.imageMaxHeight
|
|
309
|
+
});
|
|
310
|
+
if (!p.success) {
|
|
311
|
+
if (n == null || n.close(), (T = p.error) != null && T.size)
|
|
312
|
+
return t({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
|
|
313
|
+
if ((P = p.error) != null && P.format)
|
|
314
|
+
return t({ message: `请上传格式为${a.imageAllowedType.map((I) => I.toUpperCase()).join("、")}的图片`, remove: !0 });
|
|
315
|
+
if ((R = p.error) != null && R.pixel)
|
|
316
|
+
return t({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
|
|
223
317
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (!
|
|
228
|
-
return
|
|
229
|
-
|
|
318
|
+
const c = await q(u);
|
|
319
|
+
if (!c.success)
|
|
320
|
+
return n == null || n.close(), t({ message: c == null ? void 0 : c.errorMessage, remove: !0 });
|
|
321
|
+
if (!f.value)
|
|
322
|
+
return n == null || n.close(), t({ message: "缺少图片上传配置", remove: !0 });
|
|
323
|
+
let w = o.filename();
|
|
324
|
+
c.hasConversion && (w = `${(E = v.split(".")) == null ? void 0 : E[0]}.jpeg`);
|
|
325
|
+
const A = await ((O = f.value) == null ? void 0 : O.call(f, c.file, w, { extParameters: a.extParameters }));
|
|
326
|
+
if (!A.success)
|
|
327
|
+
return n == null || n.close(), t({ message: A.errorMessage, remove: !0 });
|
|
328
|
+
n == null || n.close(), e(A.url);
|
|
230
329
|
});
|
|
330
|
+
},
|
|
331
|
+
setup(o) {
|
|
332
|
+
o.ui.registry.addMenuItem("localImage", {
|
|
333
|
+
text: "图片",
|
|
334
|
+
icon: "image",
|
|
335
|
+
onAction: () => {
|
|
336
|
+
g.value.dialogVisible = !0, setTimeout(() => {
|
|
337
|
+
var t;
|
|
338
|
+
const e = (t = document == null ? void 0 : document.querySelector) == null ? void 0 : t.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
339
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
}), o.ui.registry.addButton("localImage", {
|
|
343
|
+
icon: "image",
|
|
344
|
+
tooltip: "图片",
|
|
345
|
+
onAction: () => {
|
|
346
|
+
g.value.dialogVisible = !0, setTimeout(() => {
|
|
347
|
+
var t;
|
|
348
|
+
const e = (t = document == null ? void 0 : document.querySelector) == null ? void 0 : t.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
349
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}), a.audioEnable && (o.ui.registry.addMenuItem("localAudio", {
|
|
353
|
+
text: "音频",
|
|
354
|
+
icon: "arrow-right",
|
|
355
|
+
onAction: () => {
|
|
356
|
+
r.value.dialogVisible = !0, setTimeout(() => {
|
|
357
|
+
var t;
|
|
358
|
+
const e = (t = document == null ? void 0 : document.querySelector) == null ? void 0 : t.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
359
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
}), o.ui.registry.addButton("localAudio", {
|
|
363
|
+
icon: "arrow-right",
|
|
364
|
+
tooltip: "音频",
|
|
365
|
+
onAction: () => {
|
|
366
|
+
r.value.dialogVisible = !0, setTimeout(() => {
|
|
367
|
+
var t;
|
|
368
|
+
const e = (t = document == null ? void 0 : document.querySelector) == null ? void 0 : t.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
369
|
+
e && (e.innerHTML = a.imageUploadTip || "上传");
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
})), a.videoEnable && (o.ui.registry.addMenuItem("localVideo", {
|
|
373
|
+
text: "视频",
|
|
374
|
+
icon: "embed",
|
|
375
|
+
onAction: () => {
|
|
376
|
+
s.value.dialogVisible = !0;
|
|
377
|
+
}
|
|
378
|
+
}), o.ui.registry.addButton("localVideo", {
|
|
379
|
+
icon: "embed",
|
|
380
|
+
tooltip: "视频",
|
|
381
|
+
onAction: () => {
|
|
382
|
+
s.value.dialogVisible = !0;
|
|
383
|
+
}
|
|
384
|
+
}));
|
|
231
385
|
}
|
|
232
|
-
},
|
|
386
|
+
}, l = x(
|
|
233
387
|
[
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
388
|
+
a.options,
|
|
389
|
+
b.tinymceOptions,
|
|
390
|
+
i
|
|
237
391
|
],
|
|
238
392
|
{
|
|
239
|
-
mergeFunction: (
|
|
240
|
-
|
|
393
|
+
mergeFunction: (o, e) => (...t) => {
|
|
394
|
+
o(...t), e(...t);
|
|
241
395
|
},
|
|
242
396
|
type: Object
|
|
243
397
|
}
|
|
244
398
|
);
|
|
245
|
-
|
|
399
|
+
j.init(l).then(([o]) => {
|
|
246
400
|
var e;
|
|
247
|
-
|
|
248
|
-
if (
|
|
249
|
-
|
|
401
|
+
o && (o.customProps = { ...a }, o.on("change input Redo Undo SetContent", () => {
|
|
402
|
+
if (V.value) {
|
|
403
|
+
V.value = !1;
|
|
250
404
|
return;
|
|
251
405
|
}
|
|
252
|
-
|
|
253
|
-
}), (e =
|
|
406
|
+
U.value = !0, S("input", o.getContent()), S("update:modelValue", o.getContent());
|
|
407
|
+
}), (e = a.initComplete) == null || e.call(a, { editorIns: o }), d.value = o);
|
|
254
408
|
});
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
409
|
+
});
|
|
410
|
+
const ae = () => {
|
|
411
|
+
var i, l;
|
|
412
|
+
return ((l = (i = _.value) == null ? void 0 : i.data) == null ? void 0 : l.call(i, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
|
|
413
|
+
}, ie = () => {
|
|
414
|
+
var i, l;
|
|
415
|
+
return ((l = (i = _.value) == null ? void 0 : i.headers) == null ? void 0 : l.call(i, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
|
|
416
|
+
}, oe = (i, l, o) => {
|
|
417
|
+
var t, n;
|
|
418
|
+
const e = (n = (t = _ == null ? void 0 : _.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, i);
|
|
419
|
+
e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (h.error(e.errorMessage), o.splice(o.length - 1, 1)), r.value.formData.file = o;
|
|
420
|
+
}, te = (i, l) => new Promise((o, e) => {
|
|
421
|
+
const t = i.name.split(".").filter(Boolean).pop() ? i.name.split(".").filter(Boolean).pop() : "";
|
|
422
|
+
if (!a.audioAllowedType.includes(t.toUpperCase())) {
|
|
423
|
+
h.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (i.size > a.audioMaxSize * 1024 * 1024) {
|
|
427
|
+
h.info(`请上传${a.audioMaxSize}M内的音频`), e();
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
r.value.additionalData = { file: i }, o(!0);
|
|
431
|
+
}), le = (i, l) => {
|
|
432
|
+
r.value.formData.file = l;
|
|
433
|
+
}, ne = (i, l, o) => {
|
|
434
|
+
h.error("上传发生错误,请重试!"), r.value.formData.file = o;
|
|
435
|
+
}, re = () => {
|
|
436
|
+
var i, l;
|
|
437
|
+
return ((l = (i = y.value) == null ? void 0 : i.data) == null ? void 0 : l.call(i, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
|
|
438
|
+
}, se = () => {
|
|
439
|
+
var i, l;
|
|
440
|
+
return ((l = (i = y.value) == null ? void 0 : i.headers) == null ? void 0 : l.call(i, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
|
|
441
|
+
}, de = (i, l, o) => {
|
|
442
|
+
var t, n;
|
|
443
|
+
const e = (n = (t = y == null ? void 0 : y.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, i);
|
|
444
|
+
e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (h.error(e.errorMessage), o.splice(o.length - 1, 1)), s.value.formData.file = o;
|
|
445
|
+
}, ue = (i, l) => new Promise((o, e) => {
|
|
446
|
+
const t = i.name.split(".").filter(Boolean).pop() ? i.name.split(".").filter(Boolean).pop() : "";
|
|
447
|
+
if (!a.videoAllowedType.includes(t.toUpperCase())) {
|
|
448
|
+
h.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (i.size > a.videoMaxSize * 1024 * 1024) {
|
|
452
|
+
h.info(`请上传${a.videoMaxSize}M内的视频`), e();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
s.value.additionalData = { file: i }, o(!0);
|
|
456
|
+
}), me = (i, l) => {
|
|
457
|
+
s.value.formData.file = l;
|
|
458
|
+
}, pe = (i, l, o) => {
|
|
459
|
+
h.error("上传发生错误,请重试!"), s.value.formData.file = o;
|
|
460
|
+
};
|
|
461
|
+
return fe(() => {
|
|
462
|
+
var i;
|
|
463
|
+
(i = d.value) == null || i.destroy();
|
|
464
|
+
}), F(() => [a.disabled, d.value], () => {
|
|
465
|
+
var i, l;
|
|
466
|
+
(l = (i = d.value) == null ? void 0 : i.mode) == null || l.set(a.disabled ? "readonly" : "design");
|
|
467
|
+
}, { immediate: !0 }), F(
|
|
468
|
+
() => [a.value, a.modelValue, d.value],
|
|
263
469
|
() => {
|
|
264
|
-
var
|
|
265
|
-
if (
|
|
266
|
-
|
|
470
|
+
var i;
|
|
471
|
+
if (U.value) {
|
|
472
|
+
U.value = !1;
|
|
267
473
|
return;
|
|
268
474
|
}
|
|
269
|
-
|
|
475
|
+
V.value = !0, (i = d.value) == null || i.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
|
|
270
476
|
},
|
|
271
477
|
{ immediate: !0 }
|
|
272
|
-
), { __sfc: !0, insRef:
|
|
478
|
+
), { __sfc: !0, insRef: k, editorRef: d, preventSettingContent: U, preventUpdatingModelValue: V, uploadImage: g, uploadImageFormRef: z, onUploadImageClose: L, onUploadImageConfirm: J, uploadAudio: r, uploadAudioFormRef: H, onUploadAudioConfirm: K, onUploadAudioClose: Q, uploadVideo: s, uploadVideoFormRef: W, onUploadVideoConfirm: X, onUploadVideoClose: Y, onImageUploadUpload: Z, props: a, emits: S, imgPondAccept: ee, processPastedImage: B, mergeVideoUploadOptions: y, mergeAudioUploadOptions: _, mergeImgPondOptions: $, paste_preprocess: C, paste_postprocess: D, imageUploadHandle: f, getUploadAudioData: ae, getUploadAudioHeaders: ie, onUploadAudioSuccess: oe, onUploadAudioBeforeUpload: te, onUploadAudioRemove: le, onUploadAudioError: ne, getUploadVideoData: re, getUploadVideoHeaders: se, onUploadVideoSuccess: de, onUploadVideoBeforeUpload: ue, onUploadVideoRemove: me, onUploadVideoError: pe, ImgPond: he };
|
|
273
479
|
}
|
|
274
480
|
});
|
|
275
481
|
export {
|
|
276
|
-
|
|
482
|
+
ia as default
|
|
277
483
|
};
|