@keyblade/tinymce-editor-vue2 0.0.12-alpha.27 → 0.0.12-alpha.28

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
@@ -1,8 +1,7 @@
1
- import m from "./editor.vue2.js";
2
- import "./editor.vue3.js";
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, u, d, s, r, p;
4
+ var l, i, s, u, d, 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: ((u = o.mergeAudioUploadOptions) == null ? void 0 : u.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((s = (d = o.mergeAudioUploadOptions) == null ? void 0 : d.allowedType) == null ? void 0 : s.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)], 1);
14
- }, g = [], f = /* @__PURE__ */ n(
15
- m,
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((d = (u = o.mergeAudioUploadOptions) == null ? void 0 : u.allowedType) == null ? void 0 : d.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", { attrs: { visible: o.uploadLoadingConfig.show, "custom-class": "tinymce-editor-loading-dialog", "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 U = f.exports;
20
+ const _ = f.exports;
20
21
  export {
21
- U as default
22
+ _ as default
22
23
  };
package/es/editor.vue2.js CHANGED
@@ -1,10 +1,11 @@
1
- import { defineComponent as he, ref as h, computed as _, watch as S, onMounted as xe, onUnmounted as be } from "vue";
2
- import { oneTravelImgPondBeforeAddFile as J, oneTravelImageCheckAndTransform as ye, oneTravelImageCompressor as K } from "@keyblade/one-travel";
3
- import { blobToFile as Q, getFileExtension as X, getImagePixel as we } from "./util.js";
4
- import _e from "imgpond";
5
- import { conclude as C } from "vue-global-config";
6
- import Y from "tinymce";
7
- import Ce from "./langs/zh_CN.js";
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 T } from "./index.js";
37
- import { Loading as U, Message as b } from "element-ui";
38
- const sa = /* @__PURE__ */ he({
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(Z, { emit: z }) {
53
- const m = Z;
54
- Y.addI18n("zh_CN", Ce);
55
- const V = {
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
- }, B = {
66
+ }, V = {
66
67
  enable: !0,
67
68
  maxSize: 300,
68
69
  allowedType: ["mp4", "3gp"]
69
- }, H = {
70
+ }, B = {
70
71
  enable: !0,
71
72
  maxSize: 200,
72
73
  allowedType: ["mp3", "m4a", "wav", "aac"]
73
- }, R = h(), x = h(), A = h(!1), P = h(!1), c = _(() => C([m.imageUploadOptions, T.imageUploadOptions, V]) || {}), d = _(() => C([m.videoUploadOptions, T.videoUploadOptions, B]) || {}), f = _(() => C([m.audioUploadOptions, T.audioUploadOptions, H]) || {}), k = _(() => C([m.imgPondOptions, T.imgPondOptions]) || {}), ee = _(() => {
74
- var e, o;
75
- return ((o = (e = c == null ? void 0 : c.value) == null ? void 0 : e.allowedType) == null ? void 0 : o.map((i) => `.${i}`).join(",")) || "";
76
- }), D = h();
77
- S(() => D.value, () => {
78
- if (D.value) {
79
- let e;
80
- J(D.value, {
81
- onStart: () => {
82
- e = U.service({ text: "加载中...", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
83
- },
84
- onSuccess: () => {
85
- e == null || e.close();
86
- },
87
- onError: (o) => {
88
- e == null || e.close(), b.error(o);
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 M = h();
94
- S(() => M.value, () => {
95
- if (M.value) {
97
+ const S = g();
98
+ U(() => S.value, () => {
99
+ if (S.value) {
96
100
  let e;
97
- J(M.value, {
101
+ G(S.value, {
98
102
  onStart: () => {
99
- e = U.service({ text: "加载中", fullscreen: !0, customClass: "tinymce-loading", background: "rgba(0, 0, 0, 0.8)" });
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: (o) => {
105
- e == null || e.close(), b.error(o);
108
+ onError: (i) => {
109
+ e == null || e.close(), w.error(i);
106
110
  }
107
111
  });
108
112
  }
109
113
  }, { immediate: !0 });
110
- const w = h({
114
+ const _ = g({
111
115
  dialogVisible: !1,
112
116
  formData: {
113
117
  images: []
114
118
  }
115
- }), W = h(), j = () => {
116
- w.value.dialogVisible = !1, w.value.formData = {
119
+ }), R = g(), W = () => {
120
+ _.value.dialogVisible = !1, _.value.formData = {
117
121
  images: []
118
122
  };
119
- }, ae = () => {
123
+ }, ee = () => {
120
124
  var e;
121
- (e = W.value) == null || e.validate((o) => {
122
- o && (w.value.formData.images.forEach((i) => {
125
+ (e = R.value) == null || e.validate((i) => {
126
+ i && (_.value.formData.images.forEach((o) => {
123
127
  var t;
124
- let a = i;
125
- k.value.srcAt && (a = (i == null ? void 0 : i[k.value.srcAt]) || ""), (t = x.value) == null || t.insertContent(`<img src=${a} alt="" />`);
126
- }), j());
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 = h({
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
- }), $ = h(), E = () => {
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
- }, te = () => {
150
+ }, ae = () => {
147
151
  var e;
148
- (e = $.value) == null || e.validate((o) => {
149
- var i, a;
150
- o && ((a = x.value) == null || a.insertContent(`<audio controls data-name="${v.value.formData.name}" data-poster="${v.value.formData.cover[0]}" src="${(i = v.value.formData.file[0]) == null ? void 0 : i.url}"></audio>`), 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>`), $());
151
155
  });
152
- }, g = h({
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
- }), I = h(), q = () => {
161
- g.value.dialogVisible = !1, g.value.formData = {
164
+ }), E = g(), q = () => {
165
+ h.value.dialogVisible = !1, h.value.formData = {
162
166
  file: []
163
- }, g.value.additionalData = {};
164
- }, oe = () => {
167
+ }, h.value.additionalData = {};
168
+ }, te = () => {
165
169
  var e;
166
- (e = I.value) == null || e.validate((o) => {
167
- var i, a;
168
- o && ((a = x.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(i = g.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), q());
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
- }, ie = (e, o) => new Promise(async (i, a) => {
174
+ }, oe = (e, i) => new Promise(async (o, a) => {
171
175
  var r, l;
172
- const t = await K(e);
176
+ const t = await J(e);
173
177
  if (!t.success) {
174
178
  a(), setTimeout(() => {
175
- o.onError(t.errorMessage);
179
+ i.onError(t.errorMessage);
176
180
  });
177
181
  return;
178
182
  }
179
- const n = await ((l = (r = c.value).handleRequest) == null ? void 0 : l.call(r, Q(t.file, e.name), e.name, { extParameters: m.extParameters }));
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
- o.onError(n == null ? void 0 : n.errorMessage);
186
+ i.onError(n == null ? void 0 : n.errorMessage);
183
187
  });
184
188
  return;
185
189
  }
186
- i(n.url);
190
+ o(n.url);
187
191
  });
188
192
  async function F(e) {
189
- var i, a, t, n, r;
190
- const o = e.getElementsByTagName("img");
191
- for (let l of o) {
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
- (i = l == null ? void 0 : l.remove) == null || i.call(l);
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 < (c.value.minWidth || 0) && u.height < (c.value.minHeight || 0) || u.width > (c.value.maxWidth || 0) && u.height > (c.value.maxHeight || 0))) {
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 = X(s);
202
- if (!((n = (t = c.value) == null ? void 0 : t.allowedType) != null && n.includes(p.toLowerCase()))) {
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
- xe(() => {
210
- var i;
213
+ he(() => {
214
+ var o;
211
215
  const e = {
212
216
  // 设置语言
213
217
  language: "zh_CN",
214
218
  // 实例
215
- target: R.value,
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: ((i = c.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
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, L;
302
- if (!((N = c.value) != null && N.handleRequest))
305
+ var y, N, O;
306
+ if (!((y = d.value) != null && y.handleRequest))
303
307
  return n({ message: "缺少图片上传配置", remove: !0 });
304
- const r = U.service({ text: "上传中....", background: "rgba(0, 0, 0, 0.8)" });
305
- let l = a.blob(), s = l.name ? l.name : a.filename();
306
- if (!(l != null && l.name) && !(l != null && l.lastModified) && l.type === "image/png")
307
- return r == null || r.close(), n({ message: "不允许粘贴", remove: !0 });
308
- const u = await ye(l, s, {
309
- imageMaxSize: c.value.maxSize,
310
- imageAllowedType: c.value.allowedType,
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: c.value.minWidth,
313
- imageMinHeight: c.value.minHeight,
314
- imageMaxWidth: c.value.maxWidth,
315
- imageMaxHeight: c.value.maxHeight
319
+ imageMinWidth: d.value.minWidth,
320
+ imageMinHeight: d.value.minHeight,
321
+ imageMaxWidth: d.value.maxWidth,
322
+ imageMaxHeight: d.value.maxHeight
316
323
  });
317
- if (!u.success)
318
- return r == null || r.close(), n({ message: (u == null ? void 0 : u.errorMessage) || "", remove: !0 });
319
- if (u.hasTransform) {
320
- l = u.file;
321
- const G = s == null ? void 0 : s.split(".");
322
- G.pop(), s = `${G.join(",")}.jpg`;
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 p = await K(l);
325
- if (!p.success)
326
- return r == null || r.close(), n({ message: p == null ? void 0 : p.errorMessage, remove: !0 });
327
- const y = await ((L = (O = c.value).handleRequest) == null ? void 0 : L.call(O, Q(p.file, s), s, { extParameters: m.extParameters }));
328
- if (!y || !y.success)
329
- return r == null || r.close(), n({ message: y.errorMessage, remove: !0 });
330
- r == null || r.close(), t(y.url);
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
- w.value.dialogVisible = !0, setTimeout(() => {
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 = c.value) == null ? void 0 : u.tipText) || "上传");
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 = c.value) == null ? void 0 : p.tipText) || "上传");
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 = d == null ? void 0 : d.value) != null && r.enable) {
375
+ if ((r = m == null ? void 0 : m.value) != null && r.enable) {
369
376
  const l = () => {
370
- g.value.dialogVisible = !0;
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
- }, o = C(
390
+ }, i = T(
384
391
  [
385
- m.options,
386
- T.options,
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
- Y.init(o).then(([a]) => {
403
+ X.init(i).then(([a]) => {
397
404
  var t;
398
- a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
399
- if (P.value) {
400
- P.value = !1;
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
- A.value = !0, z("input", a.getContent());
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 = X(u.name) || "";
409
- (s = c.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
415
+ const p = Q(u.name) || "";
416
+ (s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
410
417
  }
411
- }), (t = m.initComplete) == null || t.call(m, { editorIns: a }), x.value = a);
418
+ }), (t = c.initComplete) == null || t.call(c, { editorIns: a }), x.value = a);
412
419
  });
413
- }), be(() => {
420
+ }), xe(() => {
414
421
  var e;
415
422
  (e = x.value) == null || e.destroy();
416
423
  });
417
- const le = () => {
418
- var o, i;
424
+ const ie = () => {
425
+ var i, o;
419
426
  const e = { ...v.value.additionalData || {} };
420
- return ((i = (o = f.value) == null ? void 0 : o.data) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
421
- }, ne = () => {
422
- var o, i;
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 ((i = (o = f.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
425
- }, re = (e, o, i) => {
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 ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), v.value.formData.file = i;
429
- }, se = (e, o) => new Promise((i, a) => {
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
- b.error(`请上传格式为${(s = (l = f.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的音频`), a();
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
- b.error(`请上传${((p = f.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
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 }, i(!0);
441
- }), ue = (e, o) => {
442
- v.value.formData.file = o;
443
- }, ce = (e, o, i) => {
444
- b.error("上传发生错误,请重试!"), v.value.formData.file = i;
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 o, i;
451
- const e = { ...g.value.additionalData || {} };
452
- return ((i = (o = d.value) == null ? void 0 : o.headers) == null ? void 0 : i.call(o, { file: e, extParameters: m.extParameters })) || {};
453
- }, pe = (e, o, i) => {
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 = d == null ? void 0 : d.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
456
- a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (b.error(a.errorMessage), i.splice(i.length - 1, 1)), g.value.formData.file = i;
457
- }, ve = (e, o) => new Promise((i, a) => {
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 = d == null ? void 0 : d.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
461
- b.error(`请上传格式为${(s = (l = d == null ? void 0 : d.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((y) => y.toUpperCase()).join("、")}的视频`), a();
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 = d == null ? void 0 : d.value) == null ? void 0 : u.maxSize) || 0) * 1024 * 1024) {
465
- b.error(`请上传${((p = d == null ? void 0 : d.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
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
- g.value.additionalData = { file: e }, i(!0);
469
- }), fe = (e, o) => {
470
- g.value.formData.file = o;
471
- }, ge = (e, o, i) => {
472
- b.error("上传发生错误,请重试!"), g.value.formData.file = i;
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 S(() => [m.disabled, x.value], () => {
475
- var e, o;
476
- (o = (e = x.value) == null ? void 0 : e.mode) == null || o.set(m.disabled ? "readonly" : "design");
477
- }, { immediate: !0 }), S(
478
- () => [m.value, x.value],
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 (A.value) {
482
- A.value = !1;
488
+ if (P.value) {
489
+ P.value = !1;
483
490
  return;
484
491
  }
485
- P.value = !0, (e = x.value) == null || e.setContent(m.value ? m.value : "");
492
+ D.value = !0, (e = x.value) == null || e.setContent(c.value ? c.value : "");
486
493
  },
487
494
  { immediate: !0 }
488
- ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: H, props: m, emits: z, insRef: R, editorRef: x, preventSettingContent: A, preventUpdatingModelValue: P, mergeImageUploadOptions: c, mergeVideoUploadOptions: d, mergeAudioUploadOptions: f, mergeImgPondOptions: k, imgPondAccept: ee, uploadImageImgPondRef: D, audioImageImgPondRef: M, uploadImage: w, uploadImageFormRef: W, onUploadImageClose: j, onUploadImageConfirm: ae, uploadAudio: v, uploadAudioFormRef: $, onUploadAudioClose: E, onUploadAudioConfirm: te, uploadVideo: g, uploadVideoFormRef: I, onUploadVideoClose: q, onUploadVideoConfirm: oe, onImageUploadUpload: ie, processPastedImage: F, getUploadAudioData: le, getUploadAudioHeaders: ne, onUploadAudioSuccess: re, onUploadAudioBeforeUpload: se, onUploadAudioRemove: ue, onUploadAudioError: ce, getUploadVideoData: me, getUploadVideoHeaders: de, onUploadVideoSuccess: pe, onUploadVideoBeforeUpload: ve, onUploadVideoRemove: fe, onUploadVideoError: ge, ImgPond: _e };
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
- sa as default
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 .el-dialog__header{display:none}.tinymce-editor-loading-dialog{margin-top:25%!important;margin-bottom:0;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__body{height:100%}.tinymce-editor-loading-dialog-content{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.tinymce-editor-loading-dialog .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.27",
5
+ "version": "0.0.12-alpha.28",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
File without changes