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

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,4 +1,4 @@
1
- import { defineComponent as he, ref as h, computed as T, watch as S, onMounted as xe, onUnmounted as we } from "vue";
1
+ import { defineComponent as he, ref as h, computed as T, watch as I, onMounted as xe, onUnmounted as we } from "vue";
2
2
  import { oneTravelImgPondBeforeAddFile as G, oneTravelImageCheckAndTransform as be, oneTravelImageCompressor as J } from "@keyblade/one-travel";
3
3
  import { blobToFile as K, getFileExtension as Q, generateUUID as ye, getImagePixel as _e } from "./util.js";
4
4
  import "./style.less.js";
@@ -36,7 +36,7 @@ import "tinymce/plugins/visualchars";
36
36
  import "tinymce/plugins/wordcount";
37
37
  import { globalProps as A } from "./index.js";
38
38
  import { Message as y } from "element-ui";
39
- const ma = /* @__PURE__ */ he({
39
+ const da = /* @__PURE__ */ he({
40
40
  __name: "editor",
41
41
  props: {
42
42
  value: { default: "" },
@@ -51,7 +51,7 @@ const ma = /* @__PURE__ */ he({
51
51
  },
52
52
  emits: ["input"],
53
53
  setup(Y, { emit: z }) {
54
- const d = Y;
54
+ const m = Y;
55
55
  X.addI18n("zh_CN", Ce);
56
56
  const H = {
57
57
  maxCount: 10,
@@ -66,19 +66,21 @@ const ma = /* @__PURE__ */ he({
66
66
  }, V = {
67
67
  enable: !0,
68
68
  maxSize: 300,
69
- allowedType: ["mp4", "3gp"]
69
+ allowedType: ["mp4", "3gp"],
70
+ accept: "video/mp4,video/3gpp"
70
71
  }, B = {
71
72
  enable: !0,
72
73
  maxSize: 200,
73
- allowedType: ["mp3", "m4a", "wav", "aac"]
74
+ allowedType: ["mp3", "m4a", "wav", "aac"],
75
+ accept: "audio/mp3,audio/wav,audio/aac,audio/x-m4a"
74
76
  }, R = h(), b = h(), D = h(!1), P = 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(() => {
79
+ }), d = T(() => C([m.imageUploadOptions, A.imageUploadOptions, H]) || {}), c = T(() => C([m.videoUploadOptions, A.videoUploadOptions, V]) || {}), g = T(() => C([m.audioUploadOptions, A.audioUploadOptions, B]) || {}), S = T(() => C([m.imgPondOptions, A.imgPondOptions]) || {}), Z = T(() => {
78
80
  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(",")) || "";
81
+ return ((i = (e = d == null ? void 0 : d.value) == null ? void 0 : e.allowedType) == null ? void 0 : i.map((t) => `.${t}`).join(",")) || "";
80
82
  }), M = h();
81
- S(() => M.value, () => {
83
+ I(() => M.value, () => {
82
84
  M.value && G(M.value, {
83
85
  onStart: () => {
84
86
  f.value = {
@@ -95,7 +97,7 @@ const ma = /* @__PURE__ */ he({
95
97
  });
96
98
  }, { immediate: !0 });
97
99
  const U = h();
98
- S(() => U.value, () => {
100
+ I(() => U.value, () => {
99
101
  U.value && G(U.value, {
100
102
  onStart: () => {
101
103
  f.value = {
@@ -123,10 +125,10 @@ const ma = /* @__PURE__ */ he({
123
125
  }, ee = () => {
124
126
  var e;
125
127
  (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="" />`);
128
+ i && (_.value.formData.images.forEach((t) => {
129
+ var o;
130
+ let a = t;
131
+ S.value.srcAt && (a = (t == null ? void 0 : t[S.value.srcAt]) || ""), (o = b.value) == null || o.insertContent(`<img src=${a} alt="" />`);
130
132
  }), $());
131
133
  });
132
134
  }, v = h({
@@ -150,8 +152,8 @@ const ma = /* @__PURE__ */ he({
150
152
  }, ae = () => {
151
153
  var e;
152
154
  (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());
155
+ var t, a;
156
+ i && ((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="${(t = v.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), j());
155
157
  });
156
158
  }, x = h({
157
159
  dialogVisible: !1,
@@ -165,44 +167,44 @@ const ma = /* @__PURE__ */ he({
165
167
  x.value.dialogVisible = !1, x.value.formData = {
166
168
  file: []
167
169
  }, x.value.additionalData = {};
168
- }, te = () => {
170
+ }, oe = () => {
169
171
  var e;
170
172
  (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());
173
+ var t, a;
174
+ i && ((a = b.value) == null || a.insertContent(`<video width="auto" height="auto" controls src="${(t = x.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), F());
173
175
  });
174
- }, oe = () => {
176
+ }, te = () => {
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
+ }, ie = (e, i) => new Promise(async (t, a) => {
179
181
  var r, l;
180
- const t = await J(e);
181
- if (!t.success) {
182
+ const o = await J(e);
183
+ if (!o.success) {
182
184
  a(), setTimeout(() => {
183
- i.onError(t.errorMessage);
185
+ i.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, K(o.file, e.name), e.name, { extParameters: m.extParameters }));
188
190
  if (!n || !(n != null && n.success)) {
189
191
  a(), setTimeout(() => {
190
192
  i.onError(n == null ? void 0 : n.errorMessage);
191
193
  });
192
194
  return;
193
195
  }
194
- o(n.url);
196
+ t(n.url);
195
197
  });
196
198
  async function N(e, i) {
197
- const a = i.node.getElementsByTagName("img"), t = [];
199
+ const a = i.node.getElementsByTagName("img"), o = [];
198
200
  for (let n = a.length - 1; n >= 0; n--) {
199
201
  const r = a[n], l = "img-" + ye();
200
- r.classList.add(l), t.push(l);
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;
@@ -211,12 +213,12 @@ const ma = /* @__PURE__ */ he({
211
213
  continue;
212
214
  } else if (p.startsWith("http://") || p.startsWith("https://")) {
213
215
  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))) {
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 = Q(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
  }
@@ -225,7 +227,7 @@ const ma = /* @__PURE__ */ he({
225
227
  });
226
228
  }
227
229
  xe(() => {
228
- var o;
230
+ var t;
229
231
  const e = {
230
232
  // 设置语言
231
233
  language: "zh_CN",
@@ -294,8 +296,11 @@ const ma = /* @__PURE__ */ he({
294
296
  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
297
  // 改动后刷新,不再弹 alert
296
298
  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 }',
299
+ 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); }',
300
+ media_poster: !1,
301
+ media_alt_source: !1,
302
+ // 取消媒体宽高设置
303
+ media_dimensions: !1,
299
304
  // 字体大小
300
305
  font_size_formats: "8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 38px",
301
306
  font_size_input_default_unit: "px",
@@ -305,19 +310,19 @@ const ma = /* @__PURE__ */ he({
305
310
  convert_urls: !1,
306
311
  paste_webkit_styles: "all",
307
312
  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",
313
+ images_file_types: ((t = d.value.allowedType) == null ? void 0 : t.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
309
314
  // 粘贴前处理
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>");
315
+ paste_preprocess(a, o) {
316
+ 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
317
  },
313
318
  // 粘贴后处理(处理异步操作)
314
- paste_postprocess(a, t) {
315
- N(a, t);
319
+ paste_postprocess(a, o) {
320
+ N(a, o);
316
321
  },
317
322
  images_upload_handler(a) {
318
- return new Promise(async (t, n) => {
319
- var w, I, L;
320
- if (!((w = m.value) != null && w.handleRequest))
323
+ return new Promise(async (o, n) => {
324
+ var w, k, L;
325
+ if (!((w = d.value) != null && w.handleRequest))
321
326
  return n({ message: "缺少图片上传配置", remove: !0 });
322
327
  f.value = {
323
328
  show: !0,
@@ -327,13 +332,13 @@ const ma = /* @__PURE__ */ he({
327
332
  if (!(r != null && r.name) && !(r != null && r.lastModified) && r.type === "image/png")
328
333
  return f.value.show = !1, n({ message: "不允许粘贴", remove: !0 });
329
334
  const s = await be(r, l, {
330
- imageMaxSize: m.value.maxSize,
331
- imageAllowedType: m.value.allowedType,
335
+ imageMaxSize: d.value.maxSize,
336
+ imageAllowedType: d.value.allowedType,
332
337
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
333
- imageMinWidth: m.value.minWidth,
334
- imageMinHeight: m.value.minHeight,
335
- imageMaxWidth: m.value.maxWidth,
336
- imageMaxHeight: m.value.maxHeight
338
+ imageMinWidth: d.value.minWidth,
339
+ imageMinHeight: d.value.minHeight,
340
+ imageMaxWidth: d.value.maxWidth,
341
+ imageMaxHeight: d.value.maxHeight
337
342
  });
338
343
  if (!s.success)
339
344
  return f.value.show = !1, n({ message: (s == null ? void 0 : s.errorMessage) || "", remove: !0 });
@@ -345,35 +350,35 @@ const ma = /* @__PURE__ */ he({
345
350
  const u = await J(r);
346
351
  if (!u.success)
347
352
  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 }));
353
+ const p = await ((L = (k = d.value).handleRequest) == null ? void 0 : L.call(k, K(u.file, l), l, { extParameters: m.extParameters }));
349
354
  if (!p || !p.success)
350
355
  return f.value.show = !1, n({ message: p.errorMessage, remove: !0 });
351
- f.value.show = !1, t(p.url);
356
+ f.value.show = !1, o(p.url);
352
357
  });
353
358
  },
354
359
  setup(a) {
355
360
  var n, r;
356
- const t = () => {
361
+ const o = () => {
357
362
  _.value.dialogVisible = !0, setTimeout(() => {
358
363
  var s, u;
359
364
  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) || "上传");
365
+ l && (l.innerHTML = ((u = d.value) == null ? void 0 : u.tipText) || "上传");
361
366
  });
362
367
  };
363
368
  if (a.ui.registry.addMenuItem("localImage", {
364
369
  text: "图片",
365
370
  icon: "image",
366
- onAction: () => t()
371
+ onAction: () => o()
367
372
  }), a.ui.registry.addButton("localImage", {
368
373
  icon: "image",
369
374
  tooltip: "图片",
370
- onAction: () => t()
375
+ onAction: () => o()
371
376
  }), (n = g == null ? void 0 : g.value) != null && n.enable) {
372
377
  const l = () => {
373
378
  v.value.dialogVisible = !0, setTimeout(() => {
374
379
  var u, p;
375
380
  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) || "上传");
381
+ s && (s.innerHTML = ((p = d.value) == null ? void 0 : p.tipText) || "上传");
377
382
  });
378
383
  };
379
384
  a.ui.registry.addMenuItem("localAudio", {
@@ -403,20 +408,20 @@ const ma = /* @__PURE__ */ he({
403
408
  }
404
409
  }, i = C(
405
410
  [
406
- d.options,
411
+ m.options,
407
412
  A.options,
408
413
  e
409
414
  ],
410
415
  {
411
- mergeFunction: (a, t) => (...n) => {
412
- a(...n), t(...n);
416
+ mergeFunction: (a, o) => (...n) => {
417
+ a(...n), o(...n);
413
418
  },
414
419
  type: Object
415
420
  }
416
421
  );
417
422
  X.init(i).then(([a]) => {
418
- var t;
419
- a && (a.customProps = { ...d }, a.on("change input Redo Undo SetContent", () => {
423
+ var o;
424
+ a && (a.customProps = { ...m }, a.on("change input Redo Undo SetContent", () => {
420
425
  if (P.value) {
421
426
  P.value = !1;
422
427
  return;
@@ -427,30 +432,30 @@ const ma = /* @__PURE__ */ he({
427
432
  const r = ((l = n.clipboardData) == null ? void 0 : l.files) || [];
428
433
  for (let u of r) {
429
434
  const p = Q(u.name) || "";
430
- (s = m.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
435
+ (s = d.value.allowedType) != null && s.includes(p.toLowerCase()) || n.preventDefault();
431
436
  }
432
- }), (t = d.initComplete) == null || t.call(d, { editorIns: a }), b.value = a);
437
+ }), (o = m.initComplete) == null || o.call(m, { editorIns: a }), b.value = a);
433
438
  });
434
439
  }), we(() => {
435
440
  var e;
436
441
  (e = b.value) == null || e.destroy();
437
442
  });
438
443
  const ne = () => {
439
- var i, o;
444
+ var i, t;
440
445
  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 })) || {};
446
+ return ((t = (i = g.value) == null ? void 0 : i.data) == null ? void 0 : t.call(i, { ...e, extParameters: m.extParameters })) || {};
442
447
  }, le = () => {
443
- var i, o;
448
+ var i, t;
444
449
  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) => {
450
+ return ((t = (i = g.value) == null ? void 0 : i.headers) == null ? void 0 : t.call(i, { ...e, extParameters: m.extParameters })) || {};
451
+ }, re = (e, i, t) => {
452
+ var o, n;
453
+ const a = (n = (o = g == null ? void 0 : g.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, e);
454
+ a != null && a.url ? t[t.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), t.splice(t.length - 1, 1)), v.value.formData.file = t;
455
+ }, se = (e, i) => new Promise((t, a) => {
451
456
  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()))) {
457
+ const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
458
+ if (!((r = (n = g.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
454
459
  y.error(`请上传格式为${(s = (l = g.value) == null ? void 0 : l.allowedType) == null ? void 0 : s.map((w) => w.toUpperCase()).join("、")}的音频`), a();
455
460
  return;
456
461
  }
@@ -458,27 +463,27 @@ const ma = /* @__PURE__ */ he({
458
463
  y.error(`请上传${((p = g.value) == null ? void 0 : p.maxSize) || 0}M内的音频`), a();
459
464
  return;
460
465
  }
461
- v.value.additionalData = { file: e }, o(!0);
466
+ v.value.additionalData = { file: e }, t(!0);
462
467
  }), ue = (e, i) => {
463
468
  v.value.formData.file = i;
464
- }, me = (e, i, o) => {
465
- y.error("上传发生错误,请重试!"), v.value.formData.file = o;
466
- }, de = () => {
467
- var i, o;
469
+ }, de = (e, i, t) => {
470
+ y.error("上传发生错误,请重试!"), v.value.formData.file = t;
471
+ }, me = () => {
472
+ var i, t;
468
473
  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 })) || {};
474
+ return ((t = (i = c.value) == null ? void 0 : i.data) == null ? void 0 : t.call(i, { ...e, extParameters: m.extParameters })) || {};
470
475
  }, ce = () => {
471
- var i, o;
476
+ var i, t;
472
477
  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) => {
478
+ return ((t = (i = c.value) == null ? void 0 : i.headers) == null ? void 0 : t.call(i, { ...e, extParameters: m.extParameters })) || {};
479
+ }, pe = (e, i, t) => {
480
+ var o, n;
481
+ const a = (n = (o = c == null ? void 0 : c.value) == null ? void 0 : o.handlerResponse) == null ? void 0 : n.call(o, e);
482
+ a != null && a.url ? t[t.length - 1].url = a.url : a != null && a.errorMessage && (y.error(a.errorMessage), t.splice(t.length - 1, 1)), x.value.formData.file = t;
483
+ }, ve = (e, i) => new Promise((t, a) => {
479
484
  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()))) {
485
+ const o = e.name.split(".").filter(Boolean).pop() ? e.name.split(".").filter(Boolean).pop() : "";
486
+ if (!((r = (n = c == null ? void 0 : c.value) == null ? void 0 : n.allowedType) != null && r.includes(o.toLowerCase()))) {
482
487
  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
488
  return;
484
489
  }
@@ -486,29 +491,29 @@ const ma = /* @__PURE__ */ he({
486
491
  y.error(`请上传${((p = c == null ? void 0 : c.value) == null ? void 0 : p.maxSize) || 0}M内的视频`), a();
487
492
  return;
488
493
  }
489
- x.value.additionalData = { file: e }, o(!0);
494
+ x.value.additionalData = { file: e }, t(!0);
490
495
  }), fe = (e, i) => {
491
496
  x.value.formData.file = i;
492
- }, ge = (e, i, o) => {
493
- y.error("上传发生错误,请重试!"), x.value.formData.file = o;
497
+ }, ge = (e, i, t) => {
498
+ y.error("上传发生错误,请重试!"), x.value.formData.file = t;
494
499
  };
495
- return S(() => [d.disabled, b.value], () => {
500
+ return I(() => [m.disabled, b.value], () => {
496
501
  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],
502
+ (i = (e = b.value) == null ? void 0 : e.mode) == null || i.set(m.disabled ? "readonly" : "design");
503
+ }, { immediate: !0 }), I(
504
+ () => [m.value, b.value],
500
505
  () => {
501
506
  var e;
502
507
  if (D.value) {
503
508
  D.value = !1;
504
509
  return;
505
510
  }
506
- P.value = !0, (e = b.value) == null || e.setContent(d.value ? d.value : "");
511
+ P.value = !0, (e = b.value) == null || e.setContent(m.value ? m.value : "");
507
512
  },
508
513
  { 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 };
514
+ ), { __sfc: !0, defaultImageUploadOptions: H, defaultVideoUploadOptions: V, defaultAudioUploadOptions: B, props: m, emits: z, insRef: R, editorRef: b, preventSettingContent: D, preventUpdatingModelValue: P, uploadLoadingConfig: f, mergeImageUploadOptions: d, mergeVideoUploadOptions: c, mergeAudioUploadOptions: g, mergeImgPondOptions: S, 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: oe, onImageUploadUploadExceed: te, onImageUploadUpload: ie, processPastedImage: N, getUploadAudioData: ne, getUploadAudioHeaders: le, onUploadAudioSuccess: re, onUploadAudioBeforeUpload: se, onUploadAudioRemove: ue, onUploadAudioError: de, getUploadVideoData: me, getUploadVideoHeaders: ce, onUploadVideoSuccess: pe, onUploadVideoBeforeUpload: ve, onUploadVideoRemove: fe, onUploadVideoError: ge, ImgPond: Te };
510
515
  }
511
516
  });
512
517
  export {
513
- ma as default
518
+ da as default
514
519
  };
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.43",
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",