@keyblade/tinymce-editor-vue2 0.0.12-alpha.31 → 0.0.12-alpha.33

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 CHANGED
@@ -3,7 +3,7 @@ import m from "./_virtual/_plugin-vue2_normalizer.js";
3
3
  var c = function() {
4
4
  var l, i, s, d, u, r, p;
5
5
  var a = this, e = a._self._c, o = a._self._setupProxy;
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) {
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 }, on: { exceed: o.onImageUploadUploadExceed }, model: { value: o.uploadImage.formData.images, callback: function(t) {
7
7
  a.$set(o.uploadImage.formData, "images", t);
8
8
  }, expression: "uploadImage.formData.images" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), e("div", { staticClass: "tips" }, [e("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [a._v("注意:")]), e("span", [a._v("1. 单次最多可同时选择" + a._s(o.mergeImageUploadOptions.maxCount) + "张图片")]), e("span", [a._v("2. 仅支持" + a._s((i = (l = o.mergeImageUploadOptions) == null ? void 0 : l.allowedType) == null ? void 0 : i.map((t) => t.toUpperCase()).join("、")) + "格式")]), e("span", [a._v("3. 单张图片大小不可超过" + a._s(o.mergeImageUploadOptions.maxSize) + "M")]), e("span", [a._v("4. 像素不低于" + a._s(o.mergeImageUploadOptions.minWidth) + "*" + a._s(o.mergeImageUploadOptions.minHeight) + "且像素不高于" + a._s(o.mergeImageUploadOptions.maxWidth) + "*" + a._s(o.mergeImageUploadOptions.maxHeight))])])], 1), e("div", { attrs: { slot: "footer" }, slot: "footer" }, [e("el-button", { on: { click: o.onUploadImageClose } }, [a._v("取消")]), e("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadImageConfirm } }, [a._v("确定")])], 1)], 1), e("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: o.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadAudioClose } }, [e("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: o.uploadAudio.formData, "label-width": "auto" } }, [e("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [e("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: o.uploadAudio.formData.name, callback: function(t) {
9
9
  a.$set(o.uploadAudio.formData, "name", t);
package/es/editor.vue2.js CHANGED
@@ -1,11 +1,11 @@
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";
1
+ import { defineComponent as xe, ref as h, computed as C, watch as S, onMounted as be, onUnmounted as we } from "vue";
2
+ import { oneTravelImgPondOnExceed as G, oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as K } from "@keyblade/one-travel";
3
+ import { blobToFile as Q, getFileExtension as X, getImagePixel as _e } from "./util.js";
4
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";
5
+ import Te from "imgpond";
6
+ import { conclude as P } from "vue-global-config";
7
+ import Y from "tinymce";
8
+ import Ce from "./langs/zh_CN.js";
9
9
  import "tinymce/skins/ui/oxide/skin";
10
10
  import "tinymce/models/dom";
11
11
  import "tinymce/themes/silver";
@@ -35,8 +35,8 @@ import "tinymce/plugins/visualblocks";
35
35
  import "tinymce/plugins/visualchars";
36
36
  import "tinymce/plugins/wordcount";
37
37
  import { globalProps as A } from "./index.js";
38
- import { Message as w, Loading as Ce } from "element-ui";
39
- const ua = /* @__PURE__ */ ge({
38
+ import { Message as b } from "element-ui";
39
+ const da = /* @__PURE__ */ xe({
40
40
  __name: "editor",
41
41
  props: {
42
42
  value: { default: "" },
@@ -50,9 +50,9 @@ const ua = /* @__PURE__ */ ge({
50
50
  initComplete: null
51
51
  },
52
52
  emits: ["input"],
53
- setup(Y, { emit: I }) {
54
- const c = Y;
55
- X.addI18n("zh_CN", _e);
53
+ setup(Z, { emit: k }) {
54
+ const m = Z;
55
+ Y.addI18n("zh_CN", Ce);
56
56
  const z = {
57
57
  maxCount: 10,
58
58
  tipText: "上传",
@@ -71,65 +71,65 @@ const ua = /* @__PURE__ */ ge({
71
71
  enable: !0,
72
72
  maxSize: 200,
73
73
  allowedType: ["mp3", "m4a", "wav", "aac"]
74
- }, H = g(), x = g(), P = g(!1), D = g(!1), b = g({
74
+ }, H = h(), w = h(), D = h(!1), M = h(!1), f = h({
75
75
  show: !1,
76
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, {
77
+ }), d = C(() => P([m.imageUploadOptions, A.imageUploadOptions, z]) || {}), c = C(() => P([m.videoUploadOptions, A.videoUploadOptions, V]) || {}), g = C(() => P([m.audioUploadOptions, A.audioUploadOptions, B]) || {}), U = C(() => P([m.imgPondOptions, A.imgPondOptions]) || {}), ee = C(() => {
78
+ var a, i;
79
+ return ((i = (a = d == null ? void 0 : d.value) == null ? void 0 : a.allowedType) == null ? void 0 : i.map((t) => `.${t}`).join(",")) || "";
80
+ }), y = h();
81
+ S(() => y.value, () => {
82
+ y.value && (G(y.value), J(y.value, {
83
83
  onStart: () => {
84
- b.value = {
84
+ f.value = {
85
85
  show: !0,
86
86
  text: "图片加载中,请稍等"
87
87
  };
88
88
  },
89
89
  onSuccess: () => {
90
- b.value.show = !1;
90
+ f.value.show = !1;
91
91
  },
92
- onError: (e) => {
93
- b.value.show = !1, w.error(e);
92
+ onError: (a) => {
93
+ f.value.show = !1, b.error(a);
94
94
  }
95
- });
95
+ }));
96
96
  }, { immediate: !0 });
97
- const S = g();
98
- U(() => S.value, () => {
99
- if (S.value) {
100
- let e;
101
- G(S.value, {
102
- onStart: () => {
103
- e = Ce.service({ text: "图片加载中,请稍等", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
104
- },
105
- onSuccess: () => {
106
- e == null || e.close();
107
- },
108
- onError: (i) => {
109
- e == null || e.close(), w.error(i);
110
- }
111
- });
112
- }
97
+ const I = h();
98
+ S(() => I.value, () => {
99
+ I.value && (G(y.value), J(I.value, {
100
+ onStart: () => {
101
+ f.value = {
102
+ show: !0,
103
+ text: "图片加载中,请稍等"
104
+ };
105
+ },
106
+ onSuccess: () => {
107
+ f.value.show = !1;
108
+ },
109
+ onError: (a) => {
110
+ f.value.show = !1, b.error(a);
111
+ }
112
+ }));
113
113
  }, { immediate: !0 });
114
- const _ = g({
114
+ const T = h({
115
115
  dialogVisible: !1,
116
116
  formData: {
117
117
  images: []
118
118
  }
119
- }), R = g(), W = () => {
120
- _.value.dialogVisible = !1, _.value.formData = {
119
+ }), R = h(), W = () => {
120
+ T.value.dialogVisible = !1, T.value.formData = {
121
121
  images: []
122
122
  };
123
- }, ee = () => {
124
- var e;
125
- (e = R.value) == null || e.validate((i) => {
126
- i && (_.value.formData.images.forEach((o) => {
127
- var t;
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="" />`);
123
+ }, ae = () => {
124
+ var a;
125
+ (a = R.value) == null || a.validate((i) => {
126
+ i && (T.value.formData.images.forEach((t) => {
127
+ var o;
128
+ let e = t;
129
+ U.value.srcAt && (e = (t == null ? void 0 : t[U.value.srcAt]) || ""), (o = w.value) == null || o.insertContent(`<img src=${e} alt="" />`);
130
130
  }), W());
131
131
  });
132
- }, v = g({
132
+ }, v = h({
133
133
  dialogVisible: !1,
134
134
  formData: {
135
135
  // 名称
@@ -141,19 +141,19 @@ const ua = /* @__PURE__ */ ge({
141
141
  },
142
142
  // 用于临时保存上传前的参数 { file: File }
143
143
  additionalData: {}
144
- }), j = g(), $ = () => {
144
+ }), E = h(), $ = () => {
145
145
  v.value.dialogVisible = !1, v.value.formData = {
146
146
  name: "",
147
147
  cover: [],
148
148
  file: []
149
149
  }, v.value.additionalData = {};
150
- }, ae = () => {
151
- var e;
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>`), $());
150
+ }, oe = () => {
151
+ var a;
152
+ (a = E.value) == null || a.validate((i) => {
153
+ var t, e;
154
+ i && ((e = w.value) == null || e.insertContent(`<audio controls data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(t = v.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), $());
155
155
  });
156
- }, h = g({
156
+ }, x = h({
157
157
  dialogVisible: !1,
158
158
  formData: {
159
159
  // 文件
@@ -161,58 +161,60 @@ const ua = /* @__PURE__ */ ge({
161
161
  },
162
162
  // 用于临时保存上传前的参数 { file: File }
163
163
  additionalData: {}
164
- }), E = g(), q = () => {
165
- h.value.dialogVisible = !1, h.value.formData = {
164
+ }), j = h(), q = () => {
165
+ x.value.dialogVisible = !1, x.value.formData = {
166
166
  file: []
167
- }, h.value.additionalData = {};
167
+ }, x.value.additionalData = {};
168
168
  }, te = () => {
169
- var e;
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
+ var a;
170
+ (a = j.value) == null || a.validate((i) => {
171
+ var t, e;
172
+ i && ((e = w.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(t = x.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), q());
173
173
  });
174
- }, oe = (e, i) => new Promise(async (o, a) => {
174
+ }, ie = () => {
175
+ b.error(`单次最多可选择${d.value.maxCount}张图片`);
176
+ }, le = (a, i) => new Promise(async (t, e) => {
175
177
  var r, l;
176
- const t = await J(e);
177
- if (!t.success) {
178
- a(), setTimeout(() => {
179
- i.onError(t.errorMessage);
178
+ const o = await K(a);
179
+ if (!o.success) {
180
+ e(), setTimeout(() => {
181
+ i.onError(o.errorMessage);
180
182
  });
181
183
  return;
182
184
  }
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 }));
185
+ const n = await ((l = (r = d.value).handleRequest) == null ? void 0 : l.call(r, Q(o.file, a.name), a.name, { extParameters: m.extParameters }));
184
186
  if (!n || !(n != null && n.success)) {
185
- a(), setTimeout(() => {
187
+ e(), setTimeout(() => {
186
188
  i.onError(n == null ? void 0 : n.errorMessage);
187
189
  });
188
190
  return;
189
191
  }
190
- o(n.url);
192
+ t(n.url);
191
193
  });
192
- async function F(e) {
193
- var o, a, t, n, r;
194
- const i = e.getElementsByTagName("img");
194
+ async function F(a) {
195
+ var t, e, o, n, r;
196
+ const i = a.getElementsByTagName("img");
195
197
  for (let l of i) {
196
198
  const s = l.src;
197
199
  if (s.startsWith("data:image"))
198
- (o = l == null ? void 0 : l.remove) == null || o.call(l);
200
+ (t = l == null ? void 0 : l.remove) == null || t.call(l);
199
201
  else if (s.startsWith("http://") || s.startsWith("https://")) {
200
- const u = await we(s);
202
+ const u = await _e(s);
201
203
  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))) {
202
- (a = l == null ? void 0 : l.remove) == null || a.call(l);
204
+ (e = l == null ? void 0 : l.remove) == null || e.call(l);
203
205
  return;
204
206
  }
205
- const p = Q(s);
206
- if (!((n = (t = d.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
207
+ const p = X(s);
208
+ if (!((n = (o = d.value) == null ? void 0 : o.allowedType) != null && n.includes(p.toLowerCase()))) {
207
209
  (r = l == null ? void 0 : l.remove) == null || r.call(l);
208
210
  return;
209
211
  }
210
212
  }
211
213
  }
212
214
  }
213
- he(() => {
214
- var o;
215
- const e = {
215
+ be(() => {
216
+ var t;
217
+ const a = {
216
218
  // 设置语言
217
219
  language: "zh_CN",
218
220
  // 实例
@@ -291,28 +293,28 @@ const ua = /* @__PURE__ */ ge({
291
293
  convert_urls: !1,
292
294
  paste_webkit_styles: "all",
293
295
  paste_data_images: !0,
294
- images_file_types: ((o = d.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
296
+ images_file_types: ((t = d.value.allowedType) == null ? void 0 : t.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
295
297
  // 粘贴前处理
296
- paste_preprocess(a, t) {
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
+ paste_preprocess(e, o) {
299
+ o.content = o.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), o.content = o.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), o.content = o.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), o.content = o.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), o.content = o.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), o.content = o.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), o.content = o.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), o.content = o.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), o.content = o.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), o.content = o.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>");
298
300
  },
299
301
  // 粘贴后处理(处理异步操作)
300
- paste_postprocess(a, t) {
301
- F(t.node);
302
+ paste_postprocess(e, o) {
303
+ F(o.node);
302
304
  },
303
- images_upload_handler(a) {
304
- return new Promise(async (t, n) => {
305
- var y, N, O;
306
- if (!((y = d.value) != null && y.handleRequest))
305
+ images_upload_handler(e) {
306
+ return new Promise(async (o, n) => {
307
+ var _, N, O;
308
+ if (!((_ = d.value) != null && _.handleRequest))
307
309
  return n({ message: "缺少图片上传配置", remove: !0 });
308
- b.value = {
310
+ f.value = {
309
311
  show: !0,
310
312
  text: "图片上传中,请稍等"
311
313
  };
312
- let r = a.blob(), l = r.name ? r.name : a.filename();
314
+ let r = e.blob(), l = r.name ? r.name : e.filename();
313
315
  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
+ return f.value.show = !1, n({ message: "不允许粘贴", remove: !0 });
317
+ const s = await ye(r, l, {
316
318
  imageMaxSize: d.value.maxSize,
317
319
  imageAllowedType: d.value.allowedType,
318
320
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
@@ -322,39 +324,39 @@ const ua = /* @__PURE__ */ ge({
322
324
  imageMaxHeight: d.value.maxHeight
323
325
  });
324
326
  if (!s.success)
325
- return b.value.show = !1, n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
327
+ return f.value.show = !1, n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
326
328
  if (s.hasTransform) {
327
329
  r = s.file;
328
330
  const L = l == null ? void 0 : l.split(".");
329
331
  L.pop(), l = `${L.join(",")}.jpg`;
330
332
  }
331
- const u = await J(r);
333
+ const u = await K(r);
332
334
  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
+ return f.value.show = !1, n({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
336
+ const p = await ((O = (N = d.value).handleRequest) == null ? void 0 : O.call(N, Q(u.file, l), l, { extParameters: m.extParameters }));
335
337
  if (!p || !p.success)
336
- return b.value.show = !1, n({ message: p.errorMessage, remove: !0 });
337
- b.value.show = !1, t(p.url);
338
+ return f.value.show = !1, n({ message: p.errorMessage, remove: !0 });
339
+ f.value.show = !1, o(p.url);
338
340
  });
339
341
  },
340
- setup(a) {
342
+ setup(e) {
341
343
  var n, r;
342
- const t = () => {
343
- _.value.dialogVisible = !0, setTimeout(() => {
344
+ const o = () => {
345
+ T.value.dialogVisible = !0, setTimeout(() => {
344
346
  var s, u;
345
347
  const l = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
346
348
  l && (l.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
347
349
  });
348
350
  };
349
- if (a.ui.registry.addMenuItem("localImage", {
351
+ if (e.ui.registry.addMenuItem("localImage", {
350
352
  text: "图片",
351
353
  icon: "image",
352
- onAction: () => t()
353
- }), a.ui.registry.addButton("localImage", {
354
+ onAction: () => o()
355
+ }), e.ui.registry.addButton("localImage", {
354
356
  icon: "image",
355
357
  tooltip: "图片",
356
- onAction: () => t()
357
- }), (n = f == null ? void 0 : f.value) != null && n.enable) {
358
+ onAction: () => o()
359
+ }), (n = g == null ? void 0 : g.value) != null && n.enable) {
358
360
  const l = () => {
359
361
  v.value.dialogVisible = !0, setTimeout(() => {
360
362
  var u, p;
@@ -362,139 +364,139 @@ const ua = /* @__PURE__ */ ge({
362
364
  s && (s.innerHTML = ((p = d.value) == null ? void 0 : p.tipText) || "上传");
363
365
  });
364
366
  };
365
- a.ui.registry.addMenuItem("localAudio", {
367
+ e.ui.registry.addMenuItem("localAudio", {
366
368
  text: "音频",
367
369
  icon: "arrow-right",
368
370
  onAction: () => l()
369
- }), a.ui.registry.addButton("localAudio", {
371
+ }), e.ui.registry.addButton("localAudio", {
370
372
  icon: "arrow-right",
371
373
  tooltip: "音频",
372
374
  onAction: () => l()
373
375
  });
374
376
  }
375
- if ((r = m == null ? void 0 : m.value) != null && r.enable) {
377
+ if ((r = c == null ? void 0 : c.value) != null && r.enable) {
376
378
  const l = () => {
377
- h.value.dialogVisible = !0;
379
+ x.value.dialogVisible = !0;
378
380
  };
379
- a.ui.registry.addMenuItem("localVideo", {
381
+ e.ui.registry.addMenuItem("localVideo", {
380
382
  text: "视频",
381
383
  icon: "embed",
382
384
  onAction: () => l()
383
- }), a.ui.registry.addButton("localVideo", {
385
+ }), e.ui.registry.addButton("localVideo", {
384
386
  icon: "embed",
385
387
  tooltip: "视频",
386
388
  onAction: () => l()
387
389
  });
388
390
  }
389
391
  }
390
- }, i = T(
392
+ }, i = P(
391
393
  [
392
- c.options,
394
+ m.options,
393
395
  A.options,
394
- e
396
+ a
395
397
  ],
396
398
  {
397
- mergeFunction: (a, t) => (...n) => {
398
- a(...n), t(...n);
399
+ mergeFunction: (e, o) => (...n) => {
400
+ e(...n), o(...n);
399
401
  },
400
402
  type: Object
401
403
  }
402
404
  );
403
- X.init(i).then(([a]) => {
404
- var t;
405
- a && (a.customProps = { ...c }, a.on("change input Redo Undo SetContent", () => {
406
- if (D.value) {
407
- D.value = !1;
405
+ Y.init(i).then(([e]) => {
406
+ var o;
407
+ e && (e.customProps = { ...m }, e.on("change input Redo Undo SetContent", () => {
408
+ if (M.value) {
409
+ M.value = !1;
408
410
  return;
409
411
  }
410
- P.value = !0, I("input", a.getContent());
411
- }), a.on("paste", (n) => {
412
+ D.value = !0, k("input", e.getContent());
413
+ }), e.on("paste", (n) => {
412
414
  var l, s;
413
415
  const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
414
416
  for (let u of r) {
415
- const p = Q(u.name) || "";
417
+ const p = X(u.name) || "";
416
418
  (s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
417
419
  }
418
- }), (t = c.initComplete) == null || t.call(c, { editorIns: a }), x.value = a);
420
+ }), (o = m.initComplete) == null || o.call(m, { editorIns: e }), w.value = e);
419
421
  });
420
- }), xe(() => {
421
- var e;
422
- (e = x.value) == null || e.destroy();
422
+ }), we(() => {
423
+ var a;
424
+ (a = w.value) == null || a.destroy();
423
425
  });
424
- const ie = () => {
425
- var i, o;
426
- const e = { ...v.value.additionalData || {} };
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;
430
- const e = { ...v.value.additionalData || {} };
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) => {
433
- var t, n;
434
- const a = (n = (t = f == null ? void 0 : f.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
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) => {
426
+ const ne = () => {
427
+ var i, t;
428
+ const a = { ...v.value.additionalData || {} };
429
+ return ((t = (i = g.value) == null ? void 0 : i.data) == null ? void 0 : t.call(i, { file: a, extParameters: m.extParameters })) || {};
430
+ }, re = () => {
431
+ var i, t;
432
+ const a = { ...v.value.additionalData || {} };
433
+ return ((t = (i = g.value) == null ? void 0 : i.headers) == null ? void 0 : t.call(i, { file: a, extParameters: m.extParameters })) || {};
434
+ }, se = (a, i, t) => {
435
+ var o, n;
436
+ const e = (n = (o = g == null ? void 0 : g.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, a);
437
+ e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (b.error(e.errorMessage), t.splice(t.length - 1, 1)), v.value.formData.file = t;
438
+ }, ue = (a, i) => new Promise((t, e) => {
437
439
  var n, r, l, s, u, p;
438
- const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
439
- if (!((r = (n = f.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
440
- w.error(`请上传格式为${(s = (l = f.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
440
+ const o = a.name.split(".").filter(Boolean).pop() ? a.name.split(".").filter(Boolean).pop() : "";
441
+ if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
442
+ b.error(`请上传格式为${(s = (l = g.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((_) => _.toUpperCase()).join("、")}的音频`), e();
441
443
  return;
442
444
  }
443
- if (e.size > (((u = f.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
444
- w.error(`请上传${((p = f.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
445
+ if (a.size > (((u = g.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
446
+ b.error(`请上传${((p = g.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), e();
445
447
  return;
446
448
  }
447
- v.value.additionalData = { file: e }, o(!0);
448
- }), se = (e, i) => {
449
+ v.value.additionalData = { file: a }, t(!0);
450
+ }), de = (a, i) => {
449
451
  v.value.formData.file = i;
450
- }, ue = (e, i, o) => {
451
- w.error("上传发生错误,请重试!"), v.value.formData.file = o;
452
- }, de = () => {
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 })) || {};
452
+ }, me = (a, i, t) => {
453
+ b.error("上传发生错误,请重试!"), v.value.formData.file = t;
456
454
  }, 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) => {
461
- var t, n;
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) => {
455
+ var i, t;
456
+ const a = { ...x.value.additionalData || {} };
457
+ return ((t = (i = c.value) == null ? void 0 : i.data) == null ? void 0 : t.call(i, { file: a, extParameters: m.extParameters })) || {};
458
+ }, pe = () => {
459
+ var i, t;
460
+ const a = { ...x.value.additionalData || {} };
461
+ return ((t = (i = c.value) == null ? void 0 : i.headers) == null ? void 0 : t.call(i, { file: a, extParameters: m.extParameters })) || {};
462
+ }, ve = (a, i, t) => {
463
+ var o, n;
464
+ const e = (n = (o = c == null ? void 0 : c.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, a);
465
+ e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (b.error(e.errorMessage), t.splice(t.length - 1, 1)), x.value.formData.file = t;
466
+ }, fe = (a, i) => new Promise((t, e) => {
465
467
  var n, r, l, s, u, p;
466
- const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
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();
468
+ const o = a.name.split(".").filter(Boolean).pop() ? a.name.split(".").filter(Boolean).pop() : "";
469
+ if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
470
+ b.error(`请上传格式为${(s = (l = c == null ? void 0 : c.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((_) => _.toUpperCase()).join("、")}的视频`), e();
469
471
  return;
470
472
  }
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();
473
+ if (a.size > (((u = c == null ? void 0 : c.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
474
+ b.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), e();
473
475
  return;
474
476
  }
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;
477
+ x.value.additionalData = { file: a }, t(!0);
478
+ }), ge = (a, i) => {
479
+ x.value.formData.file = i;
480
+ }, he = (a, i, t) => {
481
+ b.error("上传发生错误,请重试!"), x.value.formData.file = t;
480
482
  };
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],
483
+ return S(() => [m.disabled, w.value], () => {
484
+ var a, i;
485
+ (i = (a = w.value) == null ? void 0 : a.mode) == null || i.set(m.disabled ? "readonly" : "design");
486
+ }, { immediate: !0 }), S(
487
+ () => [m.value, w.value],
486
488
  () => {
487
- var e;
488
- if (P.value) {
489
- P.value = !1;
489
+ var a;
490
+ if (D.value) {
491
+ D.value = !1;
490
492
  return;
491
493
  }
492
- D.value = !0, (e = x.value) == null || e.setContent(c.value ? c.value : "");
494
+ M.value = !0, (a = w.value) == null || a.setContent(m.value ? m.value : "");
493
495
  },
494
496
  { immediate: !0 }
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 };
497
+ ), { __sfc: !0, defaultImageUploadOptions: z, defaultVideoUploadOptions: V, defaultAudioUploadOptions: B, props: m, emits: k, insRef: H, editorRef: w, preventSettingContent: D, preventUpdatingModelValue: M, uploadLoadingConfig: f, mergeImageUploadOptions: d, mergeVideoUploadOptions: c, mergeAudioUploadOptions: g, mergeImgPondOptions: U, imgPondAccept: ee, uploadImageImgPondRef: y, audioImageImgPondRef: I, uploadImage: T, uploadImageFormRef: R, onUploadImageClose: W, onUploadImageConfirm: ae, uploadAudio: v, uploadAudioFormRef: E, onUploadAudioClose: $, onUploadAudioConfirm: oe, uploadVideo: x, uploadVideoFormRef: j, onUploadVideoClose: q, onUploadVideoConfirm: te, onImageUploadUploadExceed: ie, onImageUploadUpload: le, processPastedImage: F, getUploadAudioData: ne, getUploadAudioHeaders: re, onUploadAudioSuccess: se, onUploadAudioBeforeUpload: ue, onUploadAudioRemove: de, onUploadAudioError: me, getUploadVideoData: ce, getUploadVideoHeaders: pe, onUploadVideoSuccess: ve, onUploadVideoBeforeUpload: fe, onUploadVideoRemove: ge, onUploadVideoError: he, ImgPond: Te };
496
498
  }
497
499
  });
498
500
  export {
499
- ua as default
501
+ da as default
500
502
  };
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}.tinymce-editor-loading-dialog{z-index:4000!important}.tinymce-editor-loading-dialog .el-dialog{margin-top:calc(50vh - 107px);width:388px;min-width:auto!important;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!important}.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)}}
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}.tinymce-editor-loading-dialog{z-index:4000!important}.tinymce-editor-loading-dialog .el-dialog{margin-top:calc(50vh - 107px);width:388px;min-width:auto!important;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!important}.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
@@ -2,7 +2,7 @@
2
2
  "name": "@keyblade/tinymce-editor-vue2",
3
3
  "description": "KeyBlade Tinymce Editor Vue2",
4
4
  "author": "yangshuai <704807396@qq.com>",
5
- "version": "0.0.12-alpha.31",
5
+ "version": "0.0.12-alpha.33",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
@@ -23,7 +23,7 @@
23
23
  "vue-global-config": "^0.2.6",
24
24
  "tinymce": "^7.1.0",
25
25
  "element-ui": "^2.15.14",
26
- "@keyblade/one-travel": "^2.0.3"
26
+ "@keyblade/one-travel": "^2.0.4"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^2.7.0",
package/src/index.ts CHANGED
@@ -19,7 +19,7 @@ interface TinymceEditorGlobalOptions {
19
19
  audioUploadOptions?: AudioUploadOptions;
20
20
 
21
21
  /** 视频上传选项 */
22
- videoUploadOptions?: VideoUploadOptions;
22
+ videoUploadOptions?: VideoUploadOptions;
23
23
  }
24
24
 
25
25
  // 全局属性