@keyblade/tinymce-editor-vue2 0.0.12-alpha.27 → 0.0.12-alpha.29
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.vue.js +10 -9
- package/es/editor.vue2.js +178 -171
- package/es/style.css +1 -1
- package/package.json +1 -1
- /package/es/{editor.vue3.js → style.less.js} +0 -0
package/es/editor.vue.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import n from "./_virtual/_plugin-vue2_normalizer.js";
|
|
1
|
+
import n from "./editor.vue2.js";
|
|
2
|
+
import m from "./_virtual/_plugin-vue2_normalizer.js";
|
|
4
3
|
var c = function() {
|
|
5
|
-
var l, i,
|
|
4
|
+
var l, i, s, d, u, r, p;
|
|
6
5
|
var a = this, e = a._self._c, o = a._self._setupProxy;
|
|
7
6
|
return e("div", { staticClass: "tinymce-editor" }, [e("textarea", { ref: "insRef" }), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-image-dialog", attrs: { visible: o.uploadImage.dialogVisible, title: "插入图片", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadImageClose } }, [e("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [e("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [e(o.ImgPond, a._b({ ref: "uploadImageImgPondRef", attrs: { valueType: "array", accept: o.imgPondAccept, size: o.mergeImageUploadOptions.maxSize, count: o.mergeImageUploadOptions.maxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
|
|
8
7
|
a.$set(o.uploadImage.formData, "images", t);
|
|
@@ -10,13 +9,15 @@ var c = function() {
|
|
|
10
9
|
a.$set(o.uploadAudio.formData, "name", t);
|
|
11
10
|
}, expression: "uploadAudio.formData.name" } })], 1), e("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [e(o.ImgPond, a._b({ ref: "audioImageImgPondRef", attrs: { valueType: "array", accept: o.imgPondAccept, size: o.mergeImageUploadOptions.maxSize, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
|
|
12
11
|
a.$set(o.uploadAudio.formData, "cover", t);
|
|
13
|
-
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), e("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [e("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), e("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [e("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((s = o.mergeAudioUploadOptions) == null ? void 0 : s.action) || "", data: o.getUploadAudioData(), accept: "audio/*", "list-type": "headTextContent", "before-upload": o.onUploadAudioBeforeUpload, headers: o.getUploadAudioHeaders(), "on-remove": o.onUploadAudioRemove, "on-success": o.onUploadAudioSuccess, "on-error": o.onUploadAudioError, limit: 1 } }, [e("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), e("i", { staticClass: "el-icon-upload el-icon--right" })]), e("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [a._v("支持音频格式:" + a._s((u = (d = o.mergeAudioUploadOptions) == null ? void 0 : d.allowedType) == null ? void 0 : u.map((t) => t.toUpperCase()).join("、")))])], 1)], 1)], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadAudioClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadAudioConfirm } }, [a._v("确定")])], 1)], 1), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-video-dialog", attrs: { visible: o.uploadVideo.dialogVisible, title: "插入视频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadVideoClose } }, [e("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: o.uploadVideo.formData, "label-width": "auto" } }, [e("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [e("el-upload", { class: ["upload", { "upload-hide": o.uploadVideo.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadVideo.formData.file, action: o.mergeVideoUploadOptions.action || "", data: o.getUploadVideoData(), accept: "video/*", "list-type": "headTextContent", "before-upload": o.onUploadVideoBeforeUpload, headers: o.getUploadVideoHeaders(), "on-remove": o.onUploadVideoRemove, "on-success": o.onUploadVideoSuccess, "on-error": o.onUploadVideoError, limit: 1 } }, [e("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), e("i", { staticClass: "el-icon-upload el-icon--right" })]), e("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [a._v("支持视频格式:" + a._s((p = (r = o.mergeVideoUploadOptions) == null ? void 0 : r.allowedType) == null ? void 0 : p.map((t) => t.toUpperCase()).join("、")))])], 1)], 1)], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadVideoClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadVideoConfirm } }, [a._v("确定")])], 1)], 1), e("el-dialog", { staticClass: "tinymce-editor-loading-dialog", attrs: { visible: o.uploadLoadingConfig.show, "show-close": !1, "close-on-press-escape": !1, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { "update:visible": function(t) {
|
|
13
|
+
return a.$set(o.uploadLoadingConfig, "show", t);
|
|
14
|
+
} } }, [e("div", { staticClass: "tinymce-editor-loading-dialog-content" }, [e("div", { staticClass: "tinymce-editor-spinner" }, [e("div", { staticClass: "tinymce-editor-spinner-dot1" }), e("div", { staticClass: "tinymce-editor-spinner-dot2" }), e("div", { staticClass: "tinymce-editor-spinner-dot3" })]), e("span", [a._v(a._s(o.uploadLoadingConfig.text))])])])], 1);
|
|
15
|
+
}, g = [], f = /* @__PURE__ */ m(
|
|
16
|
+
n,
|
|
16
17
|
c,
|
|
17
18
|
g
|
|
18
19
|
);
|
|
19
|
-
const
|
|
20
|
+
const _ = f.exports;
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
_ as default
|
|
22
23
|
};
|
package/es/editor.vue2.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { oneTravelImgPondBeforeAddFile as
|
|
3
|
-
import { blobToFile as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { defineComponent as ge, ref as g, computed as C, watch as U, onMounted as he, onUnmounted as xe } from "vue";
|
|
2
|
+
import { oneTravelImgPondBeforeAddFile as G, oneTravelImageCheckAndTransform as be, oneTravelImageCompressor as J } from "@keyblade/one-travel";
|
|
3
|
+
import { blobToFile as K, getFileExtension as Q, getImagePixel as we } from "./util.js";
|
|
4
|
+
import "./style.less.js";
|
|
5
|
+
import ye from "imgpond";
|
|
6
|
+
import { conclude as T } from "vue-global-config";
|
|
7
|
+
import X from "tinymce";
|
|
8
|
+
import _e from "./langs/zh_CN.js";
|
|
8
9
|
import "tinymce/skins/ui/oxide/skin";
|
|
9
10
|
import "tinymce/models/dom";
|
|
10
11
|
import "tinymce/themes/silver";
|
|
@@ -33,9 +34,9 @@ import "tinymce/plugins/table";
|
|
|
33
34
|
import "tinymce/plugins/visualblocks";
|
|
34
35
|
import "tinymce/plugins/visualchars";
|
|
35
36
|
import "tinymce/plugins/wordcount";
|
|
36
|
-
import { globalProps as
|
|
37
|
-
import {
|
|
38
|
-
const
|
|
37
|
+
import { globalProps as A } from "./index.js";
|
|
38
|
+
import { Message as w, Loading as Ce } from "element-ui";
|
|
39
|
+
const ua = /* @__PURE__ */ ge({
|
|
39
40
|
__name: "editor",
|
|
40
41
|
props: {
|
|
41
42
|
value: { default: "" },
|
|
@@ -49,10 +50,10 @@ const sa = /* @__PURE__ */ he({
|
|
|
49
50
|
initComplete: null
|
|
50
51
|
},
|
|
51
52
|
emits: ["input"],
|
|
52
|
-
setup(
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const
|
|
53
|
+
setup(Y, { emit: I }) {
|
|
54
|
+
const c = Y;
|
|
55
|
+
X.addI18n("zh_CN", _e);
|
|
56
|
+
const z = {
|
|
56
57
|
maxCount: 10,
|
|
57
58
|
tipText: "上传",
|
|
58
59
|
maxSize: 30,
|
|
@@ -62,70 +63,73 @@ const sa = /* @__PURE__ */ he({
|
|
|
62
63
|
minHeight: 50,
|
|
63
64
|
maxWidth: 6e3,
|
|
64
65
|
maxHeight: 6e3
|
|
65
|
-
},
|
|
66
|
+
}, V = {
|
|
66
67
|
enable: !0,
|
|
67
68
|
maxSize: 300,
|
|
68
69
|
allowedType: ["mp4", "3gp"]
|
|
69
|
-
},
|
|
70
|
+
}, B = {
|
|
70
71
|
enable: !0,
|
|
71
72
|
maxSize: 200,
|
|
72
73
|
allowedType: ["mp3", "m4a", "wav", "aac"]
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
74
|
+
}, H = g(), x = g(), P = g(!1), D = g(!1), b = g({
|
|
75
|
+
show: !1,
|
|
76
|
+
text: "图片上传中,请稍等"
|
|
77
|
+
}), d = C(() => T([c.imageUploadOptions, A.imageUploadOptions, z]) || {}), m = C(() => T([c.videoUploadOptions, A.videoUploadOptions, V]) || {}), f = C(() => T([c.audioUploadOptions, A.audioUploadOptions, B]) || {}), k = C(() => T([c.imgPondOptions, A.imgPondOptions]) || {}), Z = C(() => {
|
|
78
|
+
var e, i;
|
|
79
|
+
return ((i = (e = d == null ? void 0 : d.value) == null ? void 0 : e.allowedType) == null ? void 0 : i.map((o) => `.${o}`).join(",")) || "";
|
|
80
|
+
}), M = g();
|
|
81
|
+
U(() => M.value, () => {
|
|
82
|
+
M.value && G(M.value, {
|
|
83
|
+
onStart: () => {
|
|
84
|
+
b.value = {
|
|
85
|
+
show: !0,
|
|
86
|
+
text: "图片加载中,请稍等"
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
onSuccess: () => {
|
|
90
|
+
b.value.show = !1;
|
|
91
|
+
},
|
|
92
|
+
onError: (e) => {
|
|
93
|
+
b.value.show = !1, w.error(e);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
92
96
|
}, { immediate: !0 });
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
if (
|
|
97
|
+
const S = g();
|
|
98
|
+
U(() => S.value, () => {
|
|
99
|
+
if (S.value) {
|
|
96
100
|
let e;
|
|
97
|
-
|
|
101
|
+
G(S.value, {
|
|
98
102
|
onStart: () => {
|
|
99
|
-
e =
|
|
103
|
+
e = Ce.service({ text: "图片加载中,请稍等", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
|
|
100
104
|
},
|
|
101
105
|
onSuccess: () => {
|
|
102
106
|
e == null || e.close();
|
|
103
107
|
},
|
|
104
|
-
onError: (
|
|
105
|
-
e == null || e.close(),
|
|
108
|
+
onError: (i) => {
|
|
109
|
+
e == null || e.close(), w.error(i);
|
|
106
110
|
}
|
|
107
111
|
});
|
|
108
112
|
}
|
|
109
113
|
}, { immediate: !0 });
|
|
110
|
-
const
|
|
114
|
+
const _ = g({
|
|
111
115
|
dialogVisible: !1,
|
|
112
116
|
formData: {
|
|
113
117
|
images: []
|
|
114
118
|
}
|
|
115
|
-
}),
|
|
116
|
-
|
|
119
|
+
}), R = g(), W = () => {
|
|
120
|
+
_.value.dialogVisible = !1, _.value.formData = {
|
|
117
121
|
images: []
|
|
118
122
|
};
|
|
119
|
-
},
|
|
123
|
+
}, ee = () => {
|
|
120
124
|
var e;
|
|
121
|
-
(e =
|
|
122
|
-
|
|
125
|
+
(e = R.value) == null || e.validate((i) => {
|
|
126
|
+
i && (_.value.formData.images.forEach((o) => {
|
|
123
127
|
var t;
|
|
124
|
-
let a =
|
|
125
|
-
k.value.srcAt && (a = (
|
|
126
|
-
}),
|
|
128
|
+
let a = o;
|
|
129
|
+
k.value.srcAt && (a = (o == null ? void 0 : o[k.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
|
|
130
|
+
}), W());
|
|
127
131
|
});
|
|
128
|
-
}, v =
|
|
132
|
+
}, v = g({
|
|
129
133
|
dialogVisible: !1,
|
|
130
134
|
formData: {
|
|
131
135
|
// 名称
|
|
@@ -137,19 +141,19 @@ const sa = /* @__PURE__ */ he({
|
|
|
137
141
|
},
|
|
138
142
|
// 用于临时保存上传前的参数 { file: File }
|
|
139
143
|
additionalData: {}
|
|
140
|
-
}),
|
|
144
|
+
}), j = g(), $ = () => {
|
|
141
145
|
v.value.dialogVisible = !1, v.value.formData = {
|
|
142
146
|
name: "",
|
|
143
147
|
cover: [],
|
|
144
148
|
file: []
|
|
145
149
|
}, v.value.additionalData = {};
|
|
146
|
-
},
|
|
150
|
+
}, ae = () => {
|
|
147
151
|
var e;
|
|
148
|
-
(e =
|
|
149
|
-
var
|
|
150
|
-
|
|
152
|
+
(e = j.value) == null || e.validate((i) => {
|
|
153
|
+
var o, a;
|
|
154
|
+
i && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(o = v.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), $());
|
|
151
155
|
});
|
|
152
|
-
},
|
|
156
|
+
}, h = g({
|
|
153
157
|
dialogVisible: !1,
|
|
154
158
|
formData: {
|
|
155
159
|
// 文件
|
|
@@ -157,62 +161,62 @@ const sa = /* @__PURE__ */ he({
|
|
|
157
161
|
},
|
|
158
162
|
// 用于临时保存上传前的参数 { file: File }
|
|
159
163
|
additionalData: {}
|
|
160
|
-
}),
|
|
161
|
-
|
|
164
|
+
}), E = g(), q = () => {
|
|
165
|
+
h.value.dialogVisible = !1, h.value.formData = {
|
|
162
166
|
file: []
|
|
163
|
-
},
|
|
164
|
-
},
|
|
167
|
+
}, h.value.additionalData = {};
|
|
168
|
+
}, te = () => {
|
|
165
169
|
var e;
|
|
166
|
-
(e =
|
|
167
|
-
var
|
|
168
|
-
|
|
170
|
+
(e = E.value) == null || e.validate((i) => {
|
|
171
|
+
var o, a;
|
|
172
|
+
i && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(o = h.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), q());
|
|
169
173
|
});
|
|
170
|
-
},
|
|
174
|
+
}, oe = (e, i) => new Promise(async (o, a) => {
|
|
171
175
|
var r, l;
|
|
172
|
-
const t = await
|
|
176
|
+
const t = await J(e);
|
|
173
177
|
if (!t.success) {
|
|
174
178
|
a(), setTimeout(() => {
|
|
175
|
-
|
|
179
|
+
i.onError(t.errorMessage);
|
|
176
180
|
});
|
|
177
181
|
return;
|
|
178
182
|
}
|
|
179
|
-
const n = await ((l = (r =
|
|
183
|
+
const n = await ((l = (r = d.value).handleRequest) == null ? void 0 : l.call(r, K(t.file, e.name), e.name, { extParameters: c.extParameters }));
|
|
180
184
|
if (!n || !(n != null && n.success)) {
|
|
181
185
|
a(), setTimeout(() => {
|
|
182
|
-
|
|
186
|
+
i.onError(n == null ? void 0 : n.errorMessage);
|
|
183
187
|
});
|
|
184
188
|
return;
|
|
185
189
|
}
|
|
186
|
-
|
|
190
|
+
o(n.url);
|
|
187
191
|
});
|
|
188
192
|
async function F(e) {
|
|
189
|
-
var
|
|
190
|
-
const
|
|
191
|
-
for (let l of
|
|
193
|
+
var o, a, t, n, r;
|
|
194
|
+
const i = e.getElementsByTagName("img");
|
|
195
|
+
for (let l of i) {
|
|
192
196
|
const s = l.src;
|
|
193
197
|
if (s.startsWith("data:image"))
|
|
194
|
-
(
|
|
198
|
+
(o = l == null ? void 0 : l.remove) == null || o.call(l);
|
|
195
199
|
else if (s.startsWith("http://") || s.startsWith("https://")) {
|
|
196
200
|
const u = await we(s);
|
|
197
|
-
if (u && (u.width < (
|
|
201
|
+
if (u && (u.width < (d.value.minWidth || 0) && u.height < (d.value.minHeight || 0) || u.width > (d.value.maxWidth || 0) && u.height > (d.value.maxHeight || 0))) {
|
|
198
202
|
(a = l == null ? void 0 : l.remove) == null || a.call(l);
|
|
199
203
|
return;
|
|
200
204
|
}
|
|
201
|
-
const p =
|
|
202
|
-
if (!((n = (t =
|
|
205
|
+
const p = Q(s);
|
|
206
|
+
if (!((n = (t = d.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
|
|
203
207
|
(r = l == null ? void 0 : l.remove) == null || r.call(l);
|
|
204
208
|
return;
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
|
-
|
|
210
|
-
var
|
|
213
|
+
he(() => {
|
|
214
|
+
var o;
|
|
211
215
|
const e = {
|
|
212
216
|
// 设置语言
|
|
213
217
|
language: "zh_CN",
|
|
214
218
|
// 实例
|
|
215
|
-
target:
|
|
219
|
+
target: H.value,
|
|
216
220
|
// 隐藏品牌
|
|
217
221
|
branding: !1,
|
|
218
222
|
// 隐藏右上角升级按钮
|
|
@@ -287,7 +291,7 @@ const sa = /* @__PURE__ */ he({
|
|
|
287
291
|
convert_urls: !1,
|
|
288
292
|
paste_webkit_styles: "all",
|
|
289
293
|
paste_data_images: !0,
|
|
290
|
-
images_file_types: ((
|
|
294
|
+
images_file_types: ((o = d.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
|
|
291
295
|
// 粘贴前处理
|
|
292
296
|
paste_preprocess(a, t) {
|
|
293
297
|
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>");
|
|
@@ -298,45 +302,48 @@ const sa = /* @__PURE__ */ he({
|
|
|
298
302
|
},
|
|
299
303
|
images_upload_handler(a) {
|
|
300
304
|
return new Promise(async (t, n) => {
|
|
301
|
-
var N, O
|
|
302
|
-
if (!((
|
|
305
|
+
var y, N, O;
|
|
306
|
+
if (!((y = d.value) != null && y.handleRequest))
|
|
303
307
|
return n({ message: "缺少图片上传配置", remove: !0 });
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
308
|
+
b.value = {
|
|
309
|
+
show: !0,
|
|
310
|
+
text: "图片上传中,请稍等"
|
|
311
|
+
};
|
|
312
|
+
let r = a.blob(), l = r.name ? r.name : a.filename();
|
|
313
|
+
if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
|
|
314
|
+
return b.value.show = !1, n({ message: "不允许粘贴", remove: !0 });
|
|
315
|
+
const s = await be(r, l, {
|
|
316
|
+
imageMaxSize: d.value.maxSize,
|
|
317
|
+
imageAllowedType: d.value.allowedType,
|
|
311
318
|
// imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
|
|
312
|
-
imageMinWidth:
|
|
313
|
-
imageMinHeight:
|
|
314
|
-
imageMaxWidth:
|
|
315
|
-
imageMaxHeight:
|
|
319
|
+
imageMinWidth: d.value.minWidth,
|
|
320
|
+
imageMinHeight: d.value.minHeight,
|
|
321
|
+
imageMaxWidth: d.value.maxWidth,
|
|
322
|
+
imageMaxHeight: d.value.maxHeight
|
|
316
323
|
});
|
|
317
|
-
if (!
|
|
318
|
-
return
|
|
319
|
-
if (
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
324
|
+
if (!s.success)
|
|
325
|
+
return b.value.show = !1, n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
|
|
326
|
+
if (s.hasTransform) {
|
|
327
|
+
r = s.file;
|
|
328
|
+
const L = l == null ? void 0 : l.split(".");
|
|
329
|
+
L.pop(), l = `${L.join(",")}.jpg`;
|
|
323
330
|
}
|
|
324
|
-
const
|
|
325
|
-
if (!
|
|
326
|
-
return
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
return
|
|
330
|
-
|
|
331
|
+
const u = await J(r);
|
|
332
|
+
if (!u.success)
|
|
333
|
+
return b.value.show = !1, n({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
|
|
334
|
+
const p = await ((O = (N = d.value).handleRequest) == null ? void 0 : O.call(N, K(u.file, l), l, { extParameters: c.extParameters }));
|
|
335
|
+
if (!p || !p.success)
|
|
336
|
+
return b.value.show = !1, n({ message: p.errorMessage, remove: !0 });
|
|
337
|
+
b.value.show = !1, t(p.url);
|
|
331
338
|
});
|
|
332
339
|
},
|
|
333
340
|
setup(a) {
|
|
334
341
|
var n, r;
|
|
335
342
|
const t = () => {
|
|
336
|
-
|
|
343
|
+
_.value.dialogVisible = !0, setTimeout(() => {
|
|
337
344
|
var s, u;
|
|
338
345
|
const l = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
|
|
339
|
-
l && (l.innerHTML = ((u =
|
|
346
|
+
l && (l.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
|
|
340
347
|
});
|
|
341
348
|
};
|
|
342
349
|
if (a.ui.registry.addMenuItem("localImage", {
|
|
@@ -352,7 +359,7 @@ const sa = /* @__PURE__ */ he({
|
|
|
352
359
|
v.value.dialogVisible = !0, setTimeout(() => {
|
|
353
360
|
var u, p;
|
|
354
361
|
const s = (u = document == null ? void 0 : document.querySelector) == null ? void 0 : u.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
|
|
355
|
-
s && (s.innerHTML = ((p =
|
|
362
|
+
s && (s.innerHTML = ((p = d.value) == null ? void 0 : p.tipText) || "上传");
|
|
356
363
|
});
|
|
357
364
|
};
|
|
358
365
|
a.ui.registry.addMenuItem("localAudio", {
|
|
@@ -365,9 +372,9 @@ const sa = /* @__PURE__ */ he({
|
|
|
365
372
|
onAction: () => l()
|
|
366
373
|
});
|
|
367
374
|
}
|
|
368
|
-
if ((r =
|
|
375
|
+
if ((r = m == null ? void 0 : m.value) != null && r.enable) {
|
|
369
376
|
const l = () => {
|
|
370
|
-
|
|
377
|
+
h.value.dialogVisible = !0;
|
|
371
378
|
};
|
|
372
379
|
a.ui.registry.addMenuItem("localVideo", {
|
|
373
380
|
text: "视频",
|
|
@@ -380,10 +387,10 @@ const sa = /* @__PURE__ */ he({
|
|
|
380
387
|
});
|
|
381
388
|
}
|
|
382
389
|
}
|
|
383
|
-
},
|
|
390
|
+
}, i = T(
|
|
384
391
|
[
|
|
385
|
-
|
|
386
|
-
|
|
392
|
+
c.options,
|
|
393
|
+
A.options,
|
|
387
394
|
e
|
|
388
395
|
],
|
|
389
396
|
{
|
|
@@ -393,101 +400,101 @@ const sa = /* @__PURE__ */ he({
|
|
|
393
400
|
type: Object
|
|
394
401
|
}
|
|
395
402
|
);
|
|
396
|
-
|
|
403
|
+
X.init(i).then(([a]) => {
|
|
397
404
|
var t;
|
|
398
|
-
a && (a.customProps = { ...
|
|
399
|
-
if (
|
|
400
|
-
|
|
405
|
+
a && (a.customProps = { ...c }, a.on("change input Redo Undo SetContent", () => {
|
|
406
|
+
if (D.value) {
|
|
407
|
+
D.value = !1;
|
|
401
408
|
return;
|
|
402
409
|
}
|
|
403
|
-
|
|
410
|
+
P.value = !0, I("input", a.getContent());
|
|
404
411
|
}), a.on("paste", (n) => {
|
|
405
412
|
var l, s;
|
|
406
413
|
const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
|
|
407
414
|
for (let u of r) {
|
|
408
|
-
const p =
|
|
409
|
-
(s =
|
|
415
|
+
const p = Q(u.name) || "";
|
|
416
|
+
(s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
|
|
410
417
|
}
|
|
411
|
-
}), (t =
|
|
418
|
+
}), (t = c.initComplete) == null || t.call(c, { editorIns: a }), x.value = a);
|
|
412
419
|
});
|
|
413
|
-
}),
|
|
420
|
+
}), xe(() => {
|
|
414
421
|
var e;
|
|
415
422
|
(e = x.value) == null || e.destroy();
|
|
416
423
|
});
|
|
417
|
-
const
|
|
418
|
-
var
|
|
424
|
+
const ie = () => {
|
|
425
|
+
var i, o;
|
|
419
426
|
const e = { ...v.value.additionalData || {} };
|
|
420
|
-
return ((
|
|
421
|
-
},
|
|
422
|
-
var
|
|
427
|
+
return ((o = (i = f.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { file: e, extParameters: c.extParameters })) || {};
|
|
428
|
+
}, le = () => {
|
|
429
|
+
var i, o;
|
|
423
430
|
const e = { ...v.value.additionalData || {} };
|
|
424
|
-
return ((
|
|
425
|
-
},
|
|
431
|
+
return ((o = (i = f.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { file: e, extParameters: c.extParameters })) || {};
|
|
432
|
+
}, ne = (e, i, o) => {
|
|
426
433
|
var t, n;
|
|
427
434
|
const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
428
|
-
a != null && a.url ?
|
|
429
|
-
},
|
|
435
|
+
a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (w.error(a.errorMessage), o.splice(o.length - 1, 1)), v.value.formData.file = o;
|
|
436
|
+
}, re = (e, i) => new Promise((o, a) => {
|
|
430
437
|
var n, r, l, s, u, p;
|
|
431
438
|
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
432
439
|
if (!((r = (n = f.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
433
|
-
|
|
440
|
+
w.error(`请上传格式为${(s = (l = f.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
|
|
434
441
|
return;
|
|
435
442
|
}
|
|
436
443
|
if (e.size > (((u = f.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
437
|
-
|
|
444
|
+
w.error(`请上传${((p = f.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
|
|
438
445
|
return;
|
|
439
446
|
}
|
|
440
|
-
v.value.additionalData = { file: e },
|
|
441
|
-
}),
|
|
442
|
-
v.value.formData.file =
|
|
443
|
-
},
|
|
444
|
-
|
|
445
|
-
}, me = () => {
|
|
446
|
-
var o, i;
|
|
447
|
-
const e = { ...g.value.additionalData || {} };
|
|
448
|
-
return ((i = (o = d.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
|
|
447
|
+
v.value.additionalData = { file: e }, o(!0);
|
|
448
|
+
}), se = (e, i) => {
|
|
449
|
+
v.value.formData.file = i;
|
|
450
|
+
}, ue = (e, i, o) => {
|
|
451
|
+
w.error("上传发生错误,请重试!"), v.value.formData.file = o;
|
|
449
452
|
}, de = () => {
|
|
450
|
-
var
|
|
451
|
-
const e = { ...
|
|
452
|
-
return ((
|
|
453
|
-
},
|
|
453
|
+
var i, o;
|
|
454
|
+
const e = { ...h.value.additionalData || {} };
|
|
455
|
+
return ((o = (i = m.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { file: e, extParameters: c.extParameters })) || {};
|
|
456
|
+
}, ce = () => {
|
|
457
|
+
var i, o;
|
|
458
|
+
const e = { ...h.value.additionalData || {} };
|
|
459
|
+
return ((o = (i = m.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { file: e, extParameters: c.extParameters })) || {};
|
|
460
|
+
}, me = (e, i, o) => {
|
|
454
461
|
var t, n;
|
|
455
|
-
const a = (n = (t =
|
|
456
|
-
a != null && a.url ?
|
|
457
|
-
},
|
|
462
|
+
const a = (n = (t = m == null ? void 0 : m.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
|
|
463
|
+
a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (w.error(a.errorMessage), o.splice(o.length - 1, 1)), h.value.formData.file = o;
|
|
464
|
+
}, pe = (e, i) => new Promise((o, a) => {
|
|
458
465
|
var n, r, l, s, u, p;
|
|
459
466
|
const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
|
|
460
|
-
if (!((r = (n =
|
|
461
|
-
|
|
467
|
+
if (!((r = (n = m == null ? void 0 : m.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
|
|
468
|
+
w.error(`请上传格式为${(s = (l = m == null ? void 0 : m.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
|
|
462
469
|
return;
|
|
463
470
|
}
|
|
464
|
-
if (e.size > (((u =
|
|
465
|
-
|
|
471
|
+
if (e.size > (((u = m == null ? void 0 : m.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
|
|
472
|
+
w.error(`请上传${((p = m == null ? void 0 : m.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
|
|
466
473
|
return;
|
|
467
474
|
}
|
|
468
|
-
|
|
469
|
-
}),
|
|
470
|
-
|
|
471
|
-
},
|
|
472
|
-
|
|
475
|
+
h.value.additionalData = { file: e }, o(!0);
|
|
476
|
+
}), ve = (e, i) => {
|
|
477
|
+
h.value.formData.file = i;
|
|
478
|
+
}, fe = (e, i, o) => {
|
|
479
|
+
w.error("上传发生错误,请重试!"), h.value.formData.file = o;
|
|
473
480
|
};
|
|
474
|
-
return
|
|
475
|
-
var e,
|
|
476
|
-
(
|
|
477
|
-
}, { immediate: !0 }),
|
|
478
|
-
() => [
|
|
481
|
+
return U(() => [c.disabled, x.value], () => {
|
|
482
|
+
var e, i;
|
|
483
|
+
(i = (e = x.value) == null ? void 0 : e.mode) == null || i.set(c.disabled ? "readonly" : "design");
|
|
484
|
+
}, { immediate: !0 }), U(
|
|
485
|
+
() => [c.value, x.value],
|
|
479
486
|
() => {
|
|
480
487
|
var e;
|
|
481
|
-
if (
|
|
482
|
-
|
|
488
|
+
if (P.value) {
|
|
489
|
+
P.value = !1;
|
|
483
490
|
return;
|
|
484
491
|
}
|
|
485
|
-
|
|
492
|
+
D.value = !0, (e = x.value) == null || e.setContent(c.value ? c.value : "");
|
|
486
493
|
},
|
|
487
494
|
{ immediate: !0 }
|
|
488
|
-
), { __sfc: !0, defaultImageUploadOptions:
|
|
495
|
+
), { __sfc: !0, defaultImageUploadOptions: z, defaultVideoUploadOptions: V, defaultAudioUploadOptions: B, props: c, emits: I, insRef: H, editorRef: x, preventSettingContent: P, preventUpdatingModelValue: D, uploadLoadingConfig: b, mergeImageUploadOptions: d, mergeVideoUploadOptions: m, mergeAudioUploadOptions: f, mergeImgPondOptions: k, imgPondAccept: Z, uploadImageImgPondRef: M, audioImageImgPondRef: S, uploadImage: _, uploadImageFormRef: R, onUploadImageClose: W, onUploadImageConfirm: ee, uploadAudio: v, uploadAudioFormRef: j, onUploadAudioClose: $, onUploadAudioConfirm: ae, uploadVideo: h, uploadVideoFormRef: E, onUploadVideoClose: q, onUploadVideoConfirm: te, onImageUploadUpload: oe, processPastedImage: F, getUploadAudioData: ie, getUploadAudioHeaders: le, onUploadAudioSuccess: ne, onUploadAudioBeforeUpload: re, onUploadAudioRemove: se, onUploadAudioError: ue, getUploadVideoData: de, getUploadVideoHeaders: ce, onUploadVideoSuccess: me, onUploadVideoBeforeUpload: pe, onUploadVideoRemove: ve, onUploadVideoError: fe, ImgPond: ye };
|
|
489
496
|
}
|
|
490
497
|
});
|
|
491
498
|
export {
|
|
492
|
-
|
|
499
|
+
ua as default
|
|
493
500
|
};
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tox-tinymce-aux{z-index:10000!important}.tox-statusbar__branding{display:none!important}.tinymce-editor-dialog .el-dialog{min-width:600px}.tinymce-editor-upload-image-dialog .uploadImageForm{display:flex;align-content:center}.tinymce-editor-upload-image-dialog .uploadImageForm .tips{margin-left:20px;display:flex;flex-direction:column}.tinymce-editor-upload-image-dialog .uploadImageForm .tips>span{margin-bottom:16px}.tinymce-editor-dialog .upload-hide .el-upload,.tinymce-editor-dialog .upload-hide .el-upload__tip{display:none}.el-loading-mask.is-fullscreen.tinymce-loading{z-index:3000!important}
|
|
1
|
+
.tox-tinymce-aux{z-index:10000!important}.tox-statusbar__branding{display:none!important}.tinymce-editor-dialog .el-dialog{min-width:600px}.tinymce-editor-upload-image-dialog .uploadImageForm{display:flex;align-content:center}.tinymce-editor-upload-image-dialog .uploadImageForm .tips{margin-left:20px;display:flex;flex-direction:column}.tinymce-editor-upload-image-dialog .uploadImageForm .tips>span{margin-bottom:16px}.tinymce-editor-dialog .upload-hide .el-upload,.tinymce-editor-dialog .upload-hide .el-upload__tip{display:none}.el-loading-mask.is-fullscreen.tinymce-loading{z-index:3000!important}.tinymce-editor-loading-dialog{z-index:4000!important}.tinymce-editor-loading-dialog .el-dialog{width:388px;height:214px;background-image:linear-gradient(-72deg,#d8faff,#fff);box-shadow:0 2px 20px #00000012;border-radius:16px}.tinymce-editor-loading-dialog .el-dialog .el-dialog__header{display:none}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body{height:100%}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.tinymce-editor-loading-dialog .el-dialog .el-dialog__body .tinymce-editor-loading-dialog-content span{margin-top:15px;font-size:16px;color:#1d2129;line-height:24px;font-weight:500}.tinymce-editor-spinner{width:60px;height:60px;position:relative;text-align:center;-webkit-animation:sk-rotate 2s infinite linear;animation:sk-rotate 2s infinite linear}.tinymce-editor-spinner-dot1,.tinymce-editor-spinner-dot2,.tinymce-editor-spinner-dot3{width:24px;height:24px;display:inline-block;position:absolute;top:0;background-color:#333;border-radius:100%;-webkit-animation:sk-bounce 2s infinite ease-in-out;animation:sk-bounce 2s infinite ease-in-out}.tinymce-editor-spinner-dot1{left:calc(50% - 12px);background-color:#5dff8e}.tinymce-editor-spinner-dot2{top:auto;bottom:0;right:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#21f4c7}.tinymce-editor-spinner-dot3{top:auto;bottom:0;left:0;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#98ff56}@-webkit-keyframes sk-rotate{to{-webkit-transform:rotate(360deg)}}@keyframes sk-rotate{to{transform:rotate(360deg);-webkit-transform:rotate(360deg)}}@-webkit-keyframes sk-bounce{0%,to{-webkit-transform:scale(0)}50%{-webkit-transform:scale(1)}}@keyframes sk-bounce{0%,to{transform:scale(0);-webkit-transform:scale(0)}50%{transform:scale(1);-webkit-transform:scale(1)}}
|
package/package.json
CHANGED
|
File without changes
|