@keyblade/tinymce-editor-vue2 0.0.12-alpha.41 → 0.0.12-alpha.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -185,6 +185,8 @@ export interface VideoUploadOptions {
185
185
  maxSize?: number;
186
186
  /** 允许的后缀类型(小写,如: mp4) */
187
187
  allowedType?: string[];
188
+ /** 文件接收的类型 */
189
+ accept?: string;
188
190
  /** 上传地址(启用必传) */
189
191
  action?: string;
190
192
  /** 请求头 */
@@ -205,6 +207,8 @@ export interface AudioUploadOptions {
205
207
  maxSize?: number;
206
208
  /** 允许的后缀类型(小写,如: mp4) */
207
209
  allowedType?: string[];
210
+ /** 文件接收的类型 */
211
+ accept?: string;
208
212
  /** 上传地址(启用必传) */
209
213
  action?: string;
210
214
  /** 请求头 */
package/es/editor.vue.js CHANGED
@@ -9,7 +9,7 @@ var c = function() {
9
9
  a.$set(o.uploadAudio.formData, "name", t);
10
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) {
11
11
  a.$set(o.uploadAudio.formData, "cover", t);
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: { fullscreen: "", "append-to-body": "", 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) {
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: o.mergeAudioUploadOptions.accept, "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: o.mergeVideoUploadOptions.accept, "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: { fullscreen: "", "append-to-body": "", 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
13
  return a.$set(o.uploadLoadingConfig, "show", t);
14
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
15
  }, g = [], f = /* @__PURE__ */ m(
package/es/editor.vue2.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as he, ref as h, computed as T, watch as S, onMounted as xe, onUnmounted as we } 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, generateUUID as ye, getImagePixel as _e } from "./util.js";
1
+ import { defineComponent as xe, ref as h, computed as C, watch as I, onMounted as we, 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, generateUUID as _e, getImagePixel as Te } from "./util.js";
4
4
  import "./style.less.js";
5
- import Te from "imgpond";
6
- import { conclude as C } from "vue-global-config";
7
- import X from "tinymce";
8
- import Ce from "./langs/zh_CN.js";
5
+ import Ce from "imgpond";
6
+ import { conclude as A } from "vue-global-config";
7
+ import Y from "tinymce";
8
+ import Ae 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";
@@ -34,9 +34,9 @@ import "tinymce/plugins/table";
34
34
  import "tinymce/plugins/visualblocks";
35
35
  import "tinymce/plugins/visualchars";
36
36
  import "tinymce/plugins/wordcount";
37
- import { globalProps as A } from "./index.js";
37
+ import { globalProps as D } from "./index.js";
38
38
  import { Message as y } from "element-ui";
39
- const ma = /* @__PURE__ */ he({
39
+ const ma = /* @__PURE__ */ xe({
40
40
  __name: "editor",
41
41
  props: {
42
42
  value: { default: "" },
@@ -50,10 +50,10 @@ const ma = /* @__PURE__ */ he({
50
50
  initComplete: null
51
51
  },
52
52
  emits: ["input"],
53
- setup(Y, { emit: z }) {
54
- const d = Y;
55
- X.addI18n("zh_CN", Ce);
56
- const H = {
53
+ setup(Z, { emit: H }) {
54
+ const m = Z;
55
+ Y.addI18n("zh_CN", Ae);
56
+ const V = {
57
57
  maxCount: 10,
58
58
  tipText: "上传",
59
59
  maxSize: 30,
@@ -63,23 +63,25 @@ const ma = /* @__PURE__ */ he({
63
63
  minHeight: 50,
64
64
  maxWidth: 6e3,
65
65
  maxHeight: 6e3
66
- }, V = {
66
+ }, B = {
67
67
  enable: !0,
68
68
  maxSize: 300,
69
- allowedType: ["mp4", "3gp"]
70
- }, B = {
69
+ allowedType: ["mp4", "3gp"],
70
+ accept: "video/mp4,video/3gpp"
71
+ }, R = {
71
72
  enable: !0,
72
73
  maxSize: 200,
73
- allowedType: ["mp3", "m4a", "wav", "aac"]
74
- }, R = h(), b = h(), D = h(!1), P = h(!1), f = h({
74
+ allowedType: ["mp3", "m4a", "wav", "aac"],
75
+ accept: "audio/mp3,audio/wav,audio/aac,audio/x-m4a"
76
+ }, W = h(), b = h(), P = h(!1), M = h(!1), f = h({
75
77
  show: !1,
76
78
  text: "图片上传中,请稍等"
77
- }), m = T(() => C([d.imageUploadOptions, A.imageUploadOptions, H]) || {}), c = T(() => C([d.videoUploadOptions, A.videoUploadOptions, V]) || {}), g = T(() => C([d.audioUploadOptions, A.audioUploadOptions, B]) || {}), k = T(() => C([d.imgPondOptions, A.imgPondOptions]) || {}), Z = T(() => {
78
- var e, i;
79
- return ((i = (e = m == null ? void 0 : m.value) == null ? void 0 : e.allowedType) == null ? void 0 : i.map((o) => `.${o}`).join(",")) || "";
80
- }), M = h();
81
- S(() => M.value, () => {
82
- M.value && G(M.value, {
79
+ }), d = C(() => A([m.imageUploadOptions, D.imageUploadOptions, V]) || {}), c = C(() => A([m.videoUploadOptions, D.videoUploadOptions, B]) || {}), g = C(() => A([m.audioUploadOptions, D.audioUploadOptions, R]) || {}), z = C(() => A([m.imgPondOptions, D.imgPondOptions]) || {}), ee = C(() => {
80
+ var e, t;
81
+ return ((t = (e = d == null ? void 0 : d.value) == null ? void 0 : e.allowedType) == null ? void 0 : t.map((i) => `.${i}`).join(",")) || "";
82
+ }), S = h();
83
+ I(() => S.value, () => {
84
+ S.value && J(S.value, {
83
85
  onStart: () => {
84
86
  f.value = {
85
87
  show: !0,
@@ -95,8 +97,8 @@ const ma = /* @__PURE__ */ he({
95
97
  });
96
98
  }, { immediate: !0 });
97
99
  const U = h();
98
- S(() => U.value, () => {
99
- U.value && G(U.value, {
100
+ I(() => U.value, () => {
101
+ U.value && J(U.value, {
100
102
  onStart: () => {
101
103
  f.value = {
102
104
  show: !0,
@@ -111,23 +113,23 @@ const ma = /* @__PURE__ */ he({
111
113
  }
112
114
  });
113
115
  }, { immediate: !0 });
114
- const _ = h({
116
+ const T = h({
115
117
  dialogVisible: !1,
116
118
  formData: {
117
119
  images: []
118
120
  }
119
- }), W = h(), $ = () => {
120
- _.value.dialogVisible = !1, _.value.formData = {
121
+ }), $ = h(), E = () => {
122
+ T.value.dialogVisible = !1, T.value.formData = {
121
123
  images: []
122
124
  };
123
- }, ee = () => {
125
+ }, ae = () => {
124
126
  var e;
125
- (e = W.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 = b.value) == null || t.insertContent(`<img src=${a} alt="" />`);
130
- }), $());
127
+ (e = $.value) == null || e.validate((t) => {
128
+ t && (T.value.formData.images.forEach((i) => {
129
+ var o;
130
+ let a = i;
131
+ z.value.srcAt && (a = (i == null ? void 0 : i[z.value.srcAt]) || ""), (o = b.value) == null || o.insertContent(`<img src=${a} alt="" />`);
132
+ }), E());
131
133
  });
132
134
  }, v = h({
133
135
  dialogVisible: !1,
@@ -141,17 +143,17 @@ const ma = /* @__PURE__ */ he({
141
143
  },
142
144
  // 用于临时保存上传前的参数 { file: File }
143
145
  additionalData: {}
144
- }), E = h(), j = () => {
146
+ }), j = h(), q = () => {
145
147
  v.value.dialogVisible = !1, v.value.formData = {
146
148
  name: "",
147
149
  cover: [],
148
150
  file: []
149
151
  }, v.value.additionalData = {};
150
- }, ae = () => {
152
+ }, oe = () => {
151
153
  var e;
152
- (e = E.value) == null || e.validate((i) => {
153
- var o, a;
154
- i && ((a = b.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>`), j());
154
+ (e = j.value) == null || e.validate((t) => {
155
+ var i, a;
156
+ t && ((a = b.value) == null || a.insertContent(`<audio controls controlslist="nodownload noplaybackrate" 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>`), q());
155
157
  });
156
158
  }, x = h({
157
159
  dialogVisible: !1,
@@ -161,48 +163,48 @@ const ma = /* @__PURE__ */ he({
161
163
  },
162
164
  // 用于临时保存上传前的参数 { file: File }
163
165
  additionalData: {}
164
- }), q = h(), F = () => {
166
+ }), N = h(), F = () => {
165
167
  x.value.dialogVisible = !1, x.value.formData = {
166
168
  file: []
167
169
  }, x.value.additionalData = {};
168
170
  }, te = () => {
169
171
  var e;
170
- (e = q.value) == null || e.validate((i) => {
171
- var o, a;
172
- i && ((a = b.value) == null || a.insertContent(`<video controls controlslist="nodownload" src="${(o = x.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), F());
172
+ (e = N.value) == null || e.validate((t) => {
173
+ var i, a;
174
+ t && ((a = b.value) == null || a.insertContent(`<video width="auto" height="auto" controls src="${(i = x.value.formData.file[0]) == null ? void 0 : i.url}"></video>`), F());
173
175
  });
174
- }, oe = () => {
176
+ }, ie = () => {
175
177
  document.querySelectorAll(".swal2-container .swal2-title").forEach((e) => {
176
- e && (e.innerHTML = `单次最多可选择${m.value.maxCount}张图片`);
178
+ e && (e.innerHTML = `单次最多可选择${d.value.maxCount}张图片`);
177
179
  });
178
- }, ie = (e, i) => new Promise(async (o, a) => {
180
+ }, ne = (e, t) => new Promise(async (i, a) => {
179
181
  var r, l;
180
- const t = await J(e);
181
- if (!t.success) {
182
+ const o = await K(e);
183
+ if (!o.success) {
182
184
  a(), setTimeout(() => {
183
- i.onError(t.errorMessage);
185
+ t.onError(o.errorMessage);
184
186
  });
185
187
  return;
186
188
  }
187
- const n = await ((l = (r = m.value).handleRequest) == null ? void 0 : l.call(r, K(t.file, e.name), e.name, { extParameters: d.extParameters }));
189
+ const n = await ((l = (r = d.value).handleRequest) == null ? void 0 : l.call(r, Q(o.file, e.name), e.name, { extParameters: m.extParameters }));
188
190
  if (!n || !(n != null && n.success)) {
189
191
  a(), setTimeout(() => {
190
- i.onError(n == null ? void 0 : n.errorMessage);
192
+ t.onError(n == null ? void 0 : n.errorMessage);
191
193
  });
192
194
  return;
193
195
  }
194
- o(n.url);
196
+ i(n.url);
195
197
  });
196
- async function N(e, i) {
197
- const a = i.node.getElementsByTagName("img"), t = [];
198
+ async function L(e, t) {
199
+ const a = t.node.getElementsByTagName("img"), o = [];
198
200
  for (let n = a.length - 1; n >= 0; n--) {
199
- const r = a[n], l = "img-" + ye();
200
- r.classList.add(l), t.push(l);
201
+ const r = a[n], l = "img-" + _e();
202
+ r.classList.add(l), o.push(l);
201
203
  }
202
204
  setTimeout(async () => {
203
205
  var n, r;
204
- for (let l = t.length - 1; l >= 0; l--) {
205
- const s = e.dom.select(`.${t[l]}`);
206
+ for (let l = o.length - 1; l >= 0; l--) {
207
+ const s = e.dom.select(`.${o[l]}`);
206
208
  if (s.length === 0)
207
209
  continue;
208
210
  const u = s[0], p = u.src;
@@ -210,13 +212,13 @@ const ma = /* @__PURE__ */ he({
210
212
  e.dom.remove(u);
211
213
  continue;
212
214
  } else if (p.startsWith("http://") || p.startsWith("https://")) {
213
- const w = await _e(p);
214
- if (w && (w.width < (m.value.minWidth || 0) && w.height < (m.value.minHeight || 0) || w.width > (m.value.maxWidth || 0) && w.height > (m.value.maxHeight || 0))) {
215
+ const w = await Te(p);
216
+ if (w && (w.width < (d.value.minWidth || 0) && w.height < (d.value.minHeight || 0) || w.width > (d.value.maxWidth || 0) && w.height > (d.value.maxHeight || 0))) {
215
217
  e.dom.remove(u);
216
218
  continue;
217
219
  }
218
- const I = Q(p);
219
- if (!((r = (n = m.value) == null ? void 0 : n.allowedType) != null && r.includes(I.toLowerCase()))) {
220
+ const k = X(p);
221
+ if (!((r = (n = d.value) == null ? void 0 : n.allowedType) != null && r.includes(k.toLowerCase()))) {
220
222
  e.dom.remove(u);
221
223
  continue;
222
224
  }
@@ -224,13 +226,20 @@ const ma = /* @__PURE__ */ he({
224
226
  }
225
227
  });
226
228
  }
227
- xe(() => {
228
- var o;
229
+ const _ = () => {
230
+ setTimeout(() => {
231
+ var t;
232
+ const e = document.querySelector(".tox-notifications-container");
233
+ (t = e == null ? void 0 : e.remove) == null || t.call(e);
234
+ }, 2e3);
235
+ };
236
+ we(() => {
237
+ var i;
229
238
  const e = {
230
239
  // 设置语言
231
240
  language: "zh_CN",
232
241
  // 实例
233
- target: R.value,
242
+ target: W.value,
234
243
  // 隐藏品牌
235
244
  branding: !1,
236
245
  // 隐藏右上角升级按钮
@@ -294,8 +303,11 @@ const ma = /* @__PURE__ */ he({
294
303
  toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | localImage localAudio localVideo link anchor | ltr rtl",
295
304
  // 改动后刷新,不再弹 alert
296
305
  autosave_ask_before_unload: !1,
297
- // 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
298
- content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }div[data-mce-bogus="all"] .mce-object-audio { display: none }div[data-mce-bogus="all"] .mce-object-video { display: none }',
306
+ content_style: 'img {max-width:100%;}video {max-width: 100%;}body { font-family:Helvetica,Arial,sans-serif; font-size:16px }div[data-mce-bogus="all"] .mce-object-audio { display: none }div[data-mce-bogus="all"] .mce-object-video { display: none }audio::-webkit-media-controls { overflow: hidden !important }audio::-webkit-media-controls-enclosure { width: calc(100% + 32px); margin-left: auto; }audio { border-radius: 50px; }video::-webkit-media-controls { overflow: hidden !important }video::-webkit-media-controls-enclosure { width: calc(100% + 42px); margin-left: auto; }video::-webkit-media-controls-timeline { width: calc(100% - 70px); }',
307
+ media_poster: !1,
308
+ media_alt_source: !1,
309
+ // 取消媒体宽高设置
310
+ media_dimensions: !1,
299
311
  // 字体大小
300
312
  font_size_formats: "8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px",
301
313
  font_size_input_default_unit: "px",
@@ -305,75 +317,75 @@ const ma = /* @__PURE__ */ he({
305
317
  convert_urls: !1,
306
318
  paste_webkit_styles: "all",
307
319
  paste_data_images: !0,
308
- images_file_types: ((o = m.value.allowedType) == null ? void 0 : o.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
320
+ images_file_types: ((i = d.value.allowedType) == null ? void 0 : i.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
309
321
  // 粘贴前处理
310
- paste_preprocess(a, t) {
311
- 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>");
322
+ paste_preprocess(a, o) {
323
+ 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>");
312
324
  },
313
325
  // 粘贴后处理(处理异步操作)
314
- paste_postprocess(a, t) {
315
- N(a, t);
326
+ paste_postprocess(a, o) {
327
+ L(a, o);
316
328
  },
317
329
  images_upload_handler(a) {
318
- return new Promise(async (t, n) => {
319
- var w, I, L;
320
- if (!((w = m.value) != null && w.handleRequest))
321
- return n({ message: "缺少图片上传配置", remove: !0 });
330
+ return new Promise(async (o, n) => {
331
+ var w, k, O;
332
+ if (!((w = d.value) != null && w.handleRequest))
333
+ return _(), n({ message: "缺少图片上传配置", remove: !0 });
322
334
  f.value = {
323
335
  show: !0,
324
336
  text: "图片上传中,请稍等"
325
337
  };
326
338
  let r = a.blob(), l = r.name ? r.name : a.filename();
327
339
  if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
328
- return f.value.show = !1, n({ message: "不允许粘贴", remove: !0 });
329
- const s = await be(r, l, {
330
- imageMaxSize: m.value.maxSize,
331
- imageAllowedType: m.value.allowedType,
340
+ return f.value.show = !1, _(), n({ message: "不允许粘贴", remove: !0 });
341
+ const s = await ye(r, l, {
342
+ imageMaxSize: d.value.maxSize,
343
+ imageAllowedType: d.value.allowedType,
332
344
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
333
- imageMinWidth: m.value.minWidth,
334
- imageMinHeight: m.value.minHeight,
335
- imageMaxWidth: m.value.maxWidth,
336
- imageMaxHeight: m.value.maxHeight
345
+ imageMinWidth: d.value.minWidth,
346
+ imageMinHeight: d.value.minHeight,
347
+ imageMaxWidth: d.value.maxWidth,
348
+ imageMaxHeight: d.value.maxHeight
337
349
  });
338
350
  if (!s.success)
339
- return f.value.show = !1, n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
351
+ return f.value.show = !1, _(), n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
340
352
  if (s.hasTransform) {
341
353
  r = s.file;
342
- const O = l == null ? void 0 : l.split(".");
343
- O.pop(), l = `${O.join(",")}.jpg`;
354
+ const G = l == null ? void 0 : l.split(".");
355
+ G.pop(), l = `${G.join(",")}.jpg`;
344
356
  }
345
- const u = await J(r);
357
+ const u = await K(r);
346
358
  if (!u.success)
347
- return f.value.show = !1, n({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
348
- const p = await ((L = (I = m.value).handleRequest) == null ? void 0 : L.call(I, K(u.file, l), l, { extParameters: d.extParameters }));
359
+ return f.value.show = !1, _(), n({ message: u == null ? void 0 : u.errorMessage, remove: !0 });
360
+ const p = await ((O = (k = d.value).handleRequest) == null ? void 0 : O.call(k, Q(u.file, l), l, { extParameters: m.extParameters }));
349
361
  if (!p || !p.success)
350
- return f.value.show = !1, n({ message: p.errorMessage, remove: !0 });
351
- f.value.show = !1, t(p.url);
362
+ return f.value.show = !1, _(), n({ message: p.errorMessage, remove: !0 });
363
+ f.value.show = !1, o(p.url);
352
364
  });
353
365
  },
354
366
  setup(a) {
355
367
  var n, r;
356
- const t = () => {
357
- _.value.dialogVisible = !0, setTimeout(() => {
368
+ const o = () => {
369
+ T.value.dialogVisible = !0, setTimeout(() => {
358
370
  var s, u;
359
371
  const l = (s = document == null ? void 0 : document.querySelector) == null ? void 0 : s.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
360
- l && (l.innerHTML = ((u = m.value) == null ? void 0 : u.tipText) || "上传");
372
+ l && (l.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
361
373
  });
362
374
  };
363
375
  if (a.ui.registry.addMenuItem("localImage", {
364
376
  text: "图片",
365
377
  icon: "image",
366
- onAction: () => t()
378
+ onAction: () => o()
367
379
  }), a.ui.registry.addButton("localImage", {
368
380
  icon: "image",
369
381
  tooltip: "图片",
370
- onAction: () => t()
382
+ onAction: () => o()
371
383
  }), (n = g == null ? void 0 : g.value) != null && n.enable) {
372
384
  const l = () => {
373
385
  v.value.dialogVisible = !0, setTimeout(() => {
374
386
  var u, p;
375
387
  const s = (u = document == null ? void 0 : document.querySelector) == null ? void 0 : u.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
376
- s && (s.innerHTML = ((p = m.value) == null ? void 0 : p.tipText) || "上传");
388
+ s && (s.innerHTML = ((p = d.value) == null ? void 0 : p.tipText) || "上传");
377
389
  });
378
390
  };
379
391
  a.ui.registry.addMenuItem("localAudio", {
@@ -401,56 +413,58 @@ const ma = /* @__PURE__ */ he({
401
413
  });
402
414
  }
403
415
  }
404
- }, i = C(
416
+ }, t = A(
405
417
  [
406
- d.options,
407
- A.options,
418
+ m.options,
419
+ D.options,
408
420
  e
409
421
  ],
410
422
  {
411
- mergeFunction: (a, t) => (...n) => {
412
- a(...n), t(...n);
423
+ mergeFunction: (a, o) => (...n) => {
424
+ a(...n), o(...n);
413
425
  },
414
426
  type: Object
415
427
  }
416
428
  );
417
- X.init(i).then(([a]) => {
418
- var t;
419
- a && (a.customProps = { ...d }, a.on("change input Redo Undo SetContent", () => {
420
- if (P.value) {
421
- P.value = !1;
429
+ Y.init(t).then(([a]) => {
430
+ var o;
431
+ a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
432
+ if (M.value) {
433
+ M.value = !1;
422
434
  return;
423
435
  }
424
- D.value = !0, z("input", a.getContent());
436
+ P.value = !0, H("input", a.getContent());
425
437
  }), a.on("paste", (n) => {
426
438
  var l, s;
427
439
  const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
428
440
  for (let u of r) {
429
- const p = Q(u.name) || "";
430
- (s = m.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
441
+ const p = X(u.name) || "";
442
+ (s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
431
443
  }
432
- }), (t = d.initComplete) == null || t.call(d, { editorIns: a }), b.value = a);
444
+ }), a.on("drop", () => {
445
+ _();
446
+ }), (o = m.initComplete) == null || o.call(m, { editorIns: a }), b.value = a);
433
447
  });
434
- }), we(() => {
448
+ }), be(() => {
435
449
  var e;
436
450
  (e = b.value) == null || e.destroy();
437
451
  });
438
- const ne = () => {
439
- var i, o;
452
+ const le = () => {
453
+ var t, i;
440
454
  const e = { ...v.value.additionalData || {} };
441
- return ((o = (i = g.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { ...e, extParameters: d.extParameters })) || {};
442
- }, le = () => {
443
- var i, o;
455
+ return ((i = (t = g.value) == null ? void 0 : t.data) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
456
+ }, re = () => {
457
+ var t, i;
444
458
  const e = { ...v.value.additionalData || {} };
445
- return ((o = (i = g.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { ...e, extParameters: d.extParameters })) || {};
446
- }, re = (e, i, o) => {
447
- var t, n;
448
- const a = (n = (t = g == null ? void 0 : g.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
449
- a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), o.splice(o.length - 1, 1)), v.value.formData.file = o;
450
- }, se = (e, i) => new Promise((o, a) => {
459
+ return ((i = (t = g.value) == null ? void 0 : t.headers) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
460
+ }, se = (e, t, i) => {
461
+ var o, n;
462
+ const a = (n = (o = g == null ? void 0 : g.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, e);
463
+ a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), i.splice(i.length - 1, 1)), v.value.formData.file = i;
464
+ }, ue = (e, t) => new Promise((i, a) => {
451
465
  var n, r, l, s, u, p;
452
- const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
453
- if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
466
+ const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
467
+ if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
454
468
  y.error(`请上传格式为${(s = (l = g.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((w) => w.toUpperCase()).join("、")}的音频`), a();
455
469
  return;
456
470
  }
@@ -458,27 +472,27 @@ const ma = /* @__PURE__ */ he({
458
472
  y.error(`请上传${((p = g.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
459
473
  return;
460
474
  }
461
- v.value.additionalData = { file: e }, o(!0);
462
- }), ue = (e, i) => {
463
- v.value.formData.file = i;
464
- }, me = (e, i, o) => {
465
- y.error("上传发生错误,请重试!"), v.value.formData.file = o;
466
- }, de = () => {
467
- var i, o;
468
- const e = { ...x.value.additionalData || {} };
469
- return ((o = (i = c.value) == null ? void 0 : i.data) == null ? void 0 : o.call(i, { ...e, extParameters: d.extParameters })) || {};
475
+ v.value.additionalData = { file: e }, i(!0);
476
+ }), de = (e, t) => {
477
+ v.value.formData.file = t;
478
+ }, me = (e, t, i) => {
479
+ y.error("上传发生错误,请重试!"), v.value.formData.file = i;
470
480
  }, ce = () => {
471
- var i, o;
481
+ var t, i;
482
+ const e = { ...x.value.additionalData || {} };
483
+ return ((i = (t = c.value) == null ? void 0 : t.data) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
484
+ }, pe = () => {
485
+ var t, i;
472
486
  const e = { ...x.value.additionalData || {} };
473
- return ((o = (i = c.value) == null ? void 0 : i.headers) == null ? void 0 : o.call(i, { ...e, extParameters: d.extParameters })) || {};
474
- }, pe = (e, i, o) => {
475
- var t, n;
476
- const a = (n = (t = c == null ? void 0 : c.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : n.call(t, e);
477
- a != null && a.url ? o[o.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), o.splice(o.length - 1, 1)), x.value.formData.file = o;
478
- }, ve = (e, i) => new Promise((o, a) => {
487
+ return ((i = (t = c.value) == null ? void 0 : t.headers) == null ? void 0 : i.call(t, { ...e, extParameters: m.extParameters })) || {};
488
+ }, ve = (e, t, i) => {
489
+ var o, n;
490
+ const a = (n = (o = c == null ? void 0 : c.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, e);
491
+ a != null && a.url ? i[i.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), i.splice(i.length - 1, 1)), x.value.formData.file = i;
492
+ }, fe = (e, t) => new Promise((i, a) => {
479
493
  var n, r, l, s, u, p;
480
- const t = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
481
- if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(t.toLowerCase()))) {
494
+ const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
495
+ if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
482
496
  y.error(`请上传格式为${(s = (l = c == null ? void 0 : c.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((w) => w.toUpperCase()).join("、")}的视频`), a();
483
497
  return;
484
498
  }
@@ -486,27 +500,27 @@ const ma = /* @__PURE__ */ he({
486
500
  y.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
487
501
  return;
488
502
  }
489
- x.value.additionalData = { file: e }, o(!0);
490
- }), fe = (e, i) => {
491
- x.value.formData.file = i;
492
- }, ge = (e, i, o) => {
493
- y.error("上传发生错误,请重试!"), x.value.formData.file = o;
503
+ x.value.additionalData = { file: e }, i(!0);
504
+ }), ge = (e, t) => {
505
+ x.value.formData.file = t;
506
+ }, he = (e, t, i) => {
507
+ y.error("上传发生错误,请重试!"), x.value.formData.file = i;
494
508
  };
495
- return S(() => [d.disabled, b.value], () => {
496
- var e, i;
497
- (i = (e = b.value) == null ? void 0 : e.mode) == null || i.set(d.disabled ? "readonly" : "design");
498
- }, { immediate: !0 }), S(
499
- () => [d.value, b.value],
509
+ return I(() => [m.disabled, b.value], () => {
510
+ var e, t;
511
+ (t = (e = b.value) == null ? void 0 : e.mode) == null || t.set(m.disabled ? "readonly" : "design");
512
+ }, { immediate: !0 }), I(
513
+ () => [m.value, b.value],
500
514
  () => {
501
515
  var e;
502
- if (D.value) {
503
- D.value = !1;
516
+ if (P.value) {
517
+ P.value = !1;
504
518
  return;
505
519
  }
506
- P.value = !0, (e = b.value) == null || e.setContent(d.value ? d.value : "");
520
+ M.value = !0, (e = b.value) == null || e.setContent(m.value ? m.value : "");
507
521
  },
508
522
  { immediate: !0 }
509
- ), { __sfc: !0, defaultImageUploadOptions: H, defaultVideoUploadOptions: V, defaultAudioUploadOptions: B, props: d, emits: z, insRef: R, editorRef: b, preventSettingContent: D, preventUpdatingModelValue: P, uploadLoadingConfig: f, mergeImageUploadOptions: m, mergeVideoUploadOptions: c, mergeAudioUploadOptions: g, mergeImgPondOptions: k, imgPondAccept: Z, uploadImageImgPondRef: M, audioImageImgPondRef: U, uploadImage: _, uploadImageFormRef: W, onUploadImageClose: $, onUploadImageConfirm: ee, uploadAudio: v, uploadAudioFormRef: E, onUploadAudioClose: j, onUploadAudioConfirm: ae, uploadVideo: x, uploadVideoFormRef: q, onUploadVideoClose: F, onUploadVideoConfirm: te, onImageUploadUploadExceed: oe, onImageUploadUpload: ie, processPastedImage: N, getUploadAudioData: ne, getUploadAudioHeaders: le, onUploadAudioSuccess: re, onUploadAudioBeforeUpload: se, onUploadAudioRemove: ue, onUploadAudioError: me, getUploadVideoData: de, getUploadVideoHeaders: ce, onUploadVideoSuccess: pe, onUploadVideoBeforeUpload: ve, onUploadVideoRemove: fe, onUploadVideoError: ge, ImgPond: Te };
523
+ ), { __sfc: !0, defaultImageUploadOptions: V, defaultVideoUploadOptions: B, defaultAudioUploadOptions: R, props: m, emits: H, insRef: W, editorRef: b, preventSettingContent: P, preventUpdatingModelValue: M, uploadLoadingConfig: f, mergeImageUploadOptions: d, mergeVideoUploadOptions: c, mergeAudioUploadOptions: g, mergeImgPondOptions: z, imgPondAccept: ee, uploadImageImgPondRef: S, audioImageImgPondRef: U, uploadImage: T, uploadImageFormRef: $, onUploadImageClose: E, onUploadImageConfirm: ae, uploadAudio: v, uploadAudioFormRef: j, onUploadAudioClose: q, onUploadAudioConfirm: oe, uploadVideo: x, uploadVideoFormRef: N, onUploadVideoClose: F, onUploadVideoConfirm: te, onImageUploadUploadExceed: ie, onImageUploadUpload: ne, processPastedImage: L, removeNotification: _, getUploadAudioData: le, getUploadAudioHeaders: re, onUploadAudioSuccess: se, onUploadAudioBeforeUpload: ue, onUploadAudioRemove: de, onUploadAudioError: me, getUploadVideoData: ce, getUploadVideoHeaders: pe, onUploadVideoSuccess: ve, onUploadVideoBeforeUpload: fe, onUploadVideoRemove: ge, onUploadVideoError: he, ImgPond: Ce };
510
524
  }
511
525
  });
512
526
  export {
package/es/types.d.ts CHANGED
@@ -33,6 +33,8 @@ export interface VideoUploadOptions {
33
33
  maxSize?: number;
34
34
  /** 允许的后缀类型(小写,如: mp4) */
35
35
  allowedType?: string[];
36
+ /** 文件接收的类型 */
37
+ accept?: string;
36
38
  /** 上传地址(启用必传) */
37
39
  action?: string;
38
40
  /** 请求头 */
@@ -59,6 +61,8 @@ export interface AudioUploadOptions {
59
61
  maxSize?: number;
60
62
  /** 允许的后缀类型(小写,如: mp4) */
61
63
  allowedType?: string[];
64
+ /** 文件接收的类型 */
65
+ accept?: string;
62
66
  /** 上传地址(启用必传) */
63
67
  action?: string;
64
68
  /** 请求头 */
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.41",
5
+ "version": "0.0.12-alpha.44",
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.10"
26
+ "@keyblade/one-travel": "^2.0.11"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^2.7.0",