@keyblade/tinymce-editor-vue2 0.0.12-alpha.7 → 0.0.12-alpha.9

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
@@ -1,19 +1,17 @@
1
1
  # tinymce 富文本编辑器
2
2
  tinymce编辑器
3
3
 
4
- ## 零、前提
5
- 必须将vue 版本升级至2.7+
4
+ ## 前提
5
+ 必须将vue 版本升级至2.7+,按如下文档操作,一般来说只需要升级 vue、及 @vue/cli-xxx 版本即可
6
6
 
7
- - 升级指南:https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
8
-
9
- 一般来说只需要升级 vue、及 @vue/cli-xxx 版本即可
7
+ 升级指南:- https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
10
8
 
11
9
  ## 一、安装
12
10
  ```shell
13
11
  yarn add @keyblade/tinymce-editor-vue2
14
12
  # 下面两个第三方依赖注意版本,必须匹配,否则css样式有问题
15
- yarn add pic-viewer@0.5.1 (如项目中有,怎不需要再次安装)
16
- yarn add imgpond@0.6.2 (如项目中有,怎不需要再次安装)
13
+ yarn add pic-viewer@0.5.1 (如项目中已有,则忽略)
14
+ yarn add imgpond@0.6.2 (如项目中已有,则忽略)
17
15
  ```
18
16
 
19
17
  ## 二、使用
@@ -34,16 +32,12 @@ Vue.use(ImgPond, {})
34
32
 
35
33
  Vue.use(TinymceEditor, {
36
34
  imageUploadHandle: (file, filename, parameters: { extParameters: Record<string, any> }) => {
37
- const form = new FormData()
38
- form.append('file', file, filename)
39
- postRequest('/api/man/uploadFile/uploadSingleFile', form).then((res) => {
40
- debugger
41
- })
42
35
  return new Promise((resolve) => {
43
36
  setTimeout(() => {
44
37
  resolve({
45
38
  success: true,
46
- url: 'https://object.gcongo.com.cn/onecode-travel/nonClassic/8cefe379c03b5f39cd8ef725293a3c02/2024/5/1715995588295/d0b5bb458b694130be0c63e2f1d0090b.png'
39
+ url: 'https://object.gcongo.com.cn/onecode-travel/nonClassic/8cefe379c03b5f39cd8ef725293a3c02/2024/5/1715995588295/d0b5bb458b694130be0c63e2f1d0090b.png',
40
+ errorMessage: '',
47
41
  })
48
42
  }, 1000)
49
43
  })
@@ -151,7 +145,7 @@ interface TinymceEditorGlobalOptions {
151
145
  }
152
146
  ```
153
147
 
154
- ### 2.全局属性
148
+ ### 2.组件属性
155
149
  ```typescript
156
150
  interface ComponentProps {
157
151
  /** vue2 v-model */
package/es/editor.vue.js CHANGED
@@ -4,11 +4,11 @@ import i from "./_virtual/_plugin-vue2_normalizer.js";
4
4
  var d = function() {
5
5
  var l;
6
6
  var e = this, a = e._self._c, o = e._self._setupProxy;
7
- return a("div", { staticClass: "tinymce-editor" }, [a("textarea", { ref: "insRef" }), e._v(" "), a("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 } }, [a("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [a("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, count: e.imageUploadMaxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
7
+ return a("div", { staticClass: "tinymce-editor" }, [a("textarea", { ref: "insRef" }), e._v(" "), a("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 } }, [a("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [a("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", accept: o.imgPondAccept, size: e.imageMaxSize, count: e.imageUploadMaxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
8
8
  e.$set(o.uploadImage.formData, "images", t);
9
9
  }, expression: "uploadImage.formData.images" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("div", { staticClass: "tips" }, [a("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [e._v("注意:")]), a("span", [e._v("1. 单次最多可同时选择" + e._s(e.imageUploadMaxCount) + "张图片")]), a("span", [e._v("2. 仅支持" + e._s(e.imageAllowedType.map((t) => t.toUpperCase()).join("、")) + "格式")]), a("span", [e._v("3. 单张图片大小不可超过" + e._s(e.imageMaxSize) + "M")]), a("span", [e._v("4. 像素不低于" + e._s(e.imageMinWidth) + "*" + e._s(e.imageMinHeight) + "且像素不高于" + e._s(e.imageMaxWidth) + "*" + e._s(e.imageMaxHeight))])])], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadImageClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadImageConfirm } }, [e._v("确定")])], 1)], 1), a("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: o.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadAudioClose } }, [a("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: o.uploadAudio.formData, "label-width": "auto" } }, [a("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [a("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: o.uploadAudio.formData.name, callback: function(t) {
10
10
  e.$set(o.uploadAudio.formData, "name", t);
11
- }, expression: "uploadAudio.formData.name" } })], 1), a("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
11
+ }, expression: "uploadAudio.formData.name" } })], 1), a("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, accept: o.imgPondAccept, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
12
12
  e.$set(o.uploadAudio.formData, "cover", t);
13
13
  }, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((l = o.mergeAudioUploadOptions) == null ? void 0 : l.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 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持音频格式:" + e._s(e.audioAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadAudioClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadAudioConfirm } }, [e._v("确定")])], 1)], 1), a("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 } }, [a("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: o.uploadVideo.formData, "label-width": "auto" } }, [a("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("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 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持视频格式:" + e._s(e.videoAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadVideoClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadVideoConfirm } }, [e._v("确定")])], 1)], 1)], 1);
14
14
  }, s = [], r = /* @__PURE__ */ i(
package/es/editor.vue2.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as ue, ref as m, computed as w, onMounted as me, onUnmounted as pe, watch as R } from "vue";
2
- import { oneTravelImageCheck as E, oneTravelImageCompressor as O, getImagePixel as ce } from "./util.js";
3
- import ge from "imgpond";
4
- import { conclude as M } from "vue-global-config";
5
- import I from "tinymce";
6
- import fe from "./langs/zh_CN.js";
1
+ import { defineComponent as me, ref as m, computed as M, onMounted as pe, onUnmounted as ce, watch as E } from "vue";
2
+ import { oneTravelImageCheck as O, oneTravelImageCompressor as I, getImagePixel as ge } from "./util.js";
3
+ import fe from "imgpond";
4
+ import { conclude as x } from "vue-global-config";
5
+ import F from "tinymce";
6
+ import ve from "./langs/zh_CN.js";
7
7
  import "tinymce/skins/ui/oxide/skin";
8
8
  import "tinymce/models/dom";
9
9
  import "tinymce/themes/silver";
@@ -32,9 +32,9 @@ import "tinymce/plugins/table";
32
32
  import "tinymce/plugins/visualblocks";
33
33
  import "tinymce/plugins/visualchars";
34
34
  import "tinymce/plugins/wordcount";
35
- import { globalProps as x } from "./index.js";
36
- import { Loading as ve, Message as v } from "element-ui";
37
- const Ze = /* @__PURE__ */ ue({
35
+ import { globalProps as b } from "./index.js";
36
+ import { Loading as he, Message as v } from "element-ui";
37
+ const ea = /* @__PURE__ */ me({
38
38
  __name: "editor",
39
39
  props: {
40
40
  value: { default: "" },
@@ -66,24 +66,26 @@ const Ze = /* @__PURE__ */ ue({
66
66
  imgPondOptions: null
67
67
  },
68
68
  emits: ["input", "update:modelValue"],
69
- setup(F, { emit: C }) {
70
- const a = F;
71
- I.addI18n("zh_CN", fe);
72
- const P = m(), u = m(), A = m(!1), U = m(!1), c = m({
69
+ setup(q, { emit: C }) {
70
+ const a = q;
71
+ F.addI18n("zh_CN", ve);
72
+ const S = m(), d = m(), A = m(!1), T = m(!1), c = m({
73
73
  dialogVisible: !1,
74
74
  formData: {
75
75
  images: []
76
76
  }
77
- }), S = m(), q = () => {
77
+ }), k = m(), N = () => {
78
78
  c.value.dialogVisible = !1, c.value.formData = {
79
79
  images: []
80
80
  };
81
- }, N = () => {
81
+ }, j = () => {
82
82
  var o;
83
- (o = S.value) == null || o.validate((l) => {
83
+ (o = k.value) == null || o.validate((l) => {
84
84
  l && (c.value.formData.images.forEach((t) => {
85
- var e;
86
- (e = u.value) == null || e.insertContent(`<img src=${t} alt="" />`);
85
+ var e, i;
86
+ if (P.value.srcAt)
87
+ return (e = d.value) == null ? void 0 : e.insertContent(`<img src=${t == null ? void 0 : t[P.value.srcAt]} alt="" />`);
88
+ (i = d.value) == null || i.insertContent(`<img src=${t} alt="" />`);
87
89
  }), c.value.dialogVisible = !1, c.value.formData.images = []);
88
90
  });
89
91
  }, r = m({
@@ -98,17 +100,17 @@ const Ze = /* @__PURE__ */ ue({
98
100
  },
99
101
  // 用于临时保存上传前的参数 { file: File }
100
102
  additionalData: {}
101
- }), k = m(), j = () => {
103
+ }), z = m(), G = () => {
102
104
  var o;
103
- (o = k.value) == null || o.validate((l) => {
105
+ (o = z.value) == null || o.validate((l) => {
104
106
  var t, e;
105
- l && ((e = u.value) == null || e.insertContent(`<audio controls data-name="${r.value.formData.name}" data-poster="${r.value.formData.cover[0]}" src="${(t = r.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), r.value.dialogVisible = !1, r.value.formData = {
107
+ l && ((e = d.value) == null || e.insertContent(`<audio controls data-name="${r.value.formData.name}" data-poster="${r.value.formData.cover[0]}" src="${(t = r.value.formData.file[0]) == null ? void 0 : t.url}"></audio>`), r.value.dialogVisible = !1, r.value.formData = {
106
108
  name: "",
107
109
  cover: [],
108
110
  file: []
109
111
  }, r.value.additionalData = {});
110
112
  });
111
- }, G = () => {
113
+ }, L = () => {
112
114
  r.value.dialogVisible = !1, r.value.formData = {
113
115
  name: "",
114
116
  cover: [],
@@ -122,21 +124,21 @@ const Ze = /* @__PURE__ */ ue({
122
124
  },
123
125
  // 用于临时保存上传前的参数 { file: File }
124
126
  additionalData: {}
125
- }), z = m(), L = () => {
127
+ }), H = m(), J = () => {
126
128
  var o;
127
- (o = z.value) == null || o.validate((l) => {
129
+ (o = H.value) == null || o.validate((l) => {
128
130
  var t, e;
129
- l && ((e = u.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(t = s.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), s.value.dialogVisible = !1, s.value.formData = {
131
+ l && ((e = d.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(t = s.value.formData.file[0]) == null ? void 0 : t.url}"></video>`), s.value.dialogVisible = !1, s.value.formData = {
130
132
  file: []
131
133
  }, s.value.additionalData = {});
132
134
  });
133
- }, J = () => {
135
+ }, K = () => {
134
136
  s.value.dialogVisible = !1, s.value.formData = {
135
137
  file: []
136
138
  }, s.value.additionalData = {};
137
- }, K = (o, l) => new Promise(async (t, e) => {
139
+ }, Q = (o, l) => new Promise(async (t, e) => {
138
140
  var h;
139
- const i = await E(o, {
141
+ const i = await O(o, {
140
142
  imageMaxSize: a.imageMaxSize,
141
143
  imageAllowedMineType: a.imageAllowedMineType,
142
144
  imageMinWidth: a.imageMinWidth,
@@ -146,35 +148,35 @@ const Ze = /* @__PURE__ */ ue({
146
148
  });
147
149
  if (!i.success) {
148
150
  e(), setTimeout(() => {
149
- var p, f, _;
150
- (p = i.error) != null && p.size ? l.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (f = i.error) != null && f.format ? l.onError(`请上传格式为${a.imageAllowedType.map((D) => D.toUpperCase()).join("、")}的图片`) : (_ = i.error) != null && _.pixel && l.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
151
+ var p, f, w;
152
+ (p = i.error) != null && p.size ? l.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (f = i.error) != null && f.format ? l.onError(`请上传格式为${a.imageAllowedType.map((D) => D.toUpperCase()).join("、")}的图片`) : (w = i.error) != null && w.pixel && l.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
151
153
  });
152
154
  return;
153
155
  }
154
- const n = await O(o);
156
+ const n = await I(o);
155
157
  if (!n.success) {
156
158
  e(), setTimeout(() => {
157
159
  l.onError(n.errorMessage);
158
160
  });
159
161
  return;
160
162
  }
161
- const d = await ((h = g.value) == null ? void 0 : h.call(g, n.file, o.name, { extParameters: a.extParameters }));
162
- if (!d.success) {
163
+ const u = await ((h = g.value) == null ? void 0 : h.call(g, n.file, o.name, { extParameters: a.extParameters }));
164
+ if (!u.success) {
163
165
  e(), setTimeout(() => {
164
- l.onError(d.errorMessage);
166
+ l.onError(u.errorMessage);
165
167
  });
166
168
  return;
167
169
  }
168
- t(d.url);
169
- });
170
- async function H(o) {
170
+ t(u.url);
171
+ }), X = M(() => a.imageAllowedMineType.map((o) => `.${o.split("/")[1]}`).join(",") || "");
172
+ async function $(o) {
171
173
  var t, e;
172
174
  const l = o.getElementsByTagName("img");
173
175
  for (let i of l) {
174
176
  const n = i.src;
175
177
  if (n.startsWith("http://") || n.startsWith("https://")) {
176
- const d = await ce(n);
177
- if (d.width < a.imageMinWidth && d.height < a.imageMinHeight || d.width > a.imageMaxWidth && d.height > a.imageMaxHeight) {
178
+ const u = await ge(n);
179
+ if (u.width < a.imageMinWidth && u.height < a.imageMinHeight || u.width > a.imageMaxWidth && u.height > a.imageMaxHeight) {
178
180
  (t = i == null ? void 0 : i.remove) == null || t.call(i);
179
181
  return;
180
182
  }
@@ -186,25 +188,25 @@ const Ze = /* @__PURE__ */ ue({
186
188
  }
187
189
  }
188
190
  }
189
- const b = w(() => M([a.videoUploadOptions, x.videoUploadOptions]) || {}), y = w(() => M([a.audioUploadOptions, x.audioUploadOptions]) || {}), Q = w(() => M([a.imgPondOptions, x.imgPondOptions]) || {}), T = w(
190
- () => M([a.paste_preprocess, x.paste_preprocess], {
191
+ const y = M(() => x([a.videoUploadOptions, b.videoUploadOptions]) || {}), _ = M(() => x([a.audioUploadOptions, b.audioUploadOptions]) || {}), P = M(() => x([a.imgPondOptions, b.imgPondOptions]) || {}), U = M(
192
+ () => x([a.paste_preprocess, b.paste_preprocess], {
191
193
  type: Function
192
194
  })
193
- ), V = w(
194
- () => M([a.paste_postprocess, x.paste_postprocess], {
195
+ ), V = M(
196
+ () => x([a.paste_postprocess, b.paste_postprocess], {
195
197
  type: Function
196
198
  })
197
- ), g = w(
198
- () => M([a.imageUploadHandle, x.imageUploadHandle], {
199
+ ), g = M(
200
+ () => x([a.imageUploadHandle, b.imageUploadHandle], {
199
201
  type: Function
200
202
  })
201
203
  );
202
- me(() => {
204
+ pe(() => {
203
205
  const o = {
204
206
  // 设置语言
205
207
  language: "zh_CN",
206
208
  // 实例
207
- target: P.value,
209
+ target: S.value,
208
210
  // 隐藏品牌
209
211
  branding: !1,
210
212
  // 隐藏右上角升级按钮
@@ -282,20 +284,20 @@ const Ze = /* @__PURE__ */ ue({
282
284
  // 粘贴前处理
283
285
  paste_preprocess(t, e) {
284
286
  var i;
285
- e.content = e.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), e.content = e.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), e.content = e.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), e.content = e.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), e.content = e.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), e.content = e.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), e.content = e.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), e.content = e.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), e.content = e.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), e.content = e.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>"), (i = T.value) == null || i.call(T, t, e);
287
+ e.content = e.content.replace(/<video[^>]*(?:\/>|>[\s\S]*?<\/video>)/g, ""), e.content = e.content.replace(/<audio[^>]*(?:\/>|>[\s\S]*?<\/audio>)/g, ""), e.content = e.content.replace(/<nav/g, "<div").replace(/<\/nav>/g, "</div>"), e.content = e.content.replace(/<header/g, "<div").replace(/<\/header>/g, "</div>"), e.content = e.content.replace(/<footer/g, "<div").replace(/<\/footer>/g, "</div>"), e.content = e.content.replace(/<aside/g, "<div").replace(/<\/aside>/g, "</div>"), e.content = e.content.replace(/<section/g, "<div").replace(/<\/section>/g, "</div>"), e.content = e.content.replace(/<main/g, "<div").replace(/<\/main>/g, "</div>"), e.content = e.content.replace(/<article/g, "<div").replace(/<\/article>/g, "</div>"), e.content = e.content.replace(/<details/g, "<div").replace(/<\/details>/g, "</div>"), (i = U.value) == null || i.call(U, t, e);
286
288
  },
287
289
  // 粘贴后处理(处理异步操作)
288
290
  paste_postprocess(t, e) {
289
291
  var n;
290
292
  const i = e.node;
291
- H(i), (n = V.value) == null || n.call(V, t, e);
293
+ $(i), (n = V.value) == null || n.call(V, t, e);
292
294
  },
293
295
  images_upload_handler(t) {
294
296
  return new Promise(async (e, i) => {
295
- var D, W, $, B;
296
- const n = ve.service({ text: "上传中" });
297
- let d = t.blob();
298
- const h = t.filename(), p = await E(d, {
297
+ var D, W, B, R;
298
+ const n = he.service({ text: "上传中" });
299
+ let u = t.blob();
300
+ const h = t.filename(), p = await O(u, {
299
301
  imageMaxSize: a.imageMaxSize,
300
302
  imageAllowedMineType: a.imageAllowedMineType,
301
303
  imageMinWidth: a.imageMinWidth,
@@ -307,19 +309,19 @@ const Ze = /* @__PURE__ */ ue({
307
309
  if (n == null || n.close(), (D = p.error) != null && D.size)
308
310
  return i({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
309
311
  if ((W = p.error) != null && W.format)
310
- return i({ message: `请上传格式为${a.imageAllowedType.map((de) => de.toUpperCase()).join("、")}的图片`, remove: !0 });
311
- if (($ = p.error) != null && $.pixel)
312
+ return i({ message: `请上传格式为${a.imageAllowedType.map((ue) => ue.toUpperCase()).join("、")}的图片`, remove: !0 });
313
+ if ((B = p.error) != null && B.pixel)
312
314
  return i({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
313
315
  }
314
- const f = await O(d);
316
+ const f = await I(u);
315
317
  if (!f.success)
316
318
  return n == null || n.close(), i({ message: f == null ? void 0 : f.errorMessage, remove: !0 });
317
319
  if (!g.value)
318
320
  return n == null || n.close(), i({ message: "缺少图片上传配置", remove: !0 });
319
- const _ = await ((B = g.value) == null ? void 0 : B.call(g, f.file, h, { extParameters: a.extParameters }));
320
- if (!_.success)
321
- return n == null || n.close(), i({ message: _.errorMessage, remove: !0 });
322
- n == null || n.close(), e(_.url);
321
+ const w = await ((R = g.value) == null ? void 0 : R.call(g, f.file, h, { extParameters: a.extParameters }));
322
+ if (!w.success)
323
+ return n == null || n.close(), i({ message: w.errorMessage, remove: !0 });
324
+ n == null || n.close(), e(w.url);
323
325
  });
324
326
  },
325
327
  setup(t) {
@@ -377,10 +379,10 @@ const Ze = /* @__PURE__ */ ue({
377
379
  }
378
380
  }));
379
381
  }
380
- }, l = M(
382
+ }, l = x(
381
383
  [
382
384
  a.options,
383
- x.tinymceOptions,
385
+ b.tinymceOptions,
384
386
  o
385
387
  ],
386
388
  {
@@ -390,28 +392,28 @@ const Ze = /* @__PURE__ */ ue({
390
392
  type: Object
391
393
  }
392
394
  );
393
- I.init(l).then(([t]) => {
395
+ F.init(l).then(([t]) => {
394
396
  var e;
395
397
  t && (t.customProps = { ...a }, t.on("change input Redo Undo SetContent", () => {
396
- if (U.value) {
397
- U.value = !1;
398
+ if (T.value) {
399
+ T.value = !1;
398
400
  return;
399
401
  }
400
402
  A.value = !0, C("input", t.getContent()), C("update:modelValue", t.getContent());
401
- }), (e = a.initComplete) == null || e.call(a, { editorIns: t }), u.value = t);
403
+ }), (e = a.initComplete) == null || e.call(a, { editorIns: t }), d.value = t);
402
404
  });
403
405
  });
404
- const X = () => {
406
+ const Y = () => {
405
407
  var o, l;
406
- return ((l = (o = y.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { file: r.value.additionalData, extParameters: a.extParameters })) || {};
407
- }, Y = () => {
408
+ return ((l = (o = _.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
409
+ }, Z = () => {
408
410
  var o, l;
409
- return ((l = (o = y.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { file: r.value.additionalData, extParameters: a.extParameters })) || {};
410
- }, Z = (o, l, t) => {
411
+ return ((l = (o = _.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
412
+ }, ee = (o, l, t) => {
411
413
  var i, n;
412
- const e = (n = (i = y == null ? void 0 : y.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
414
+ const e = (n = (i = _ == null ? void 0 : _.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
413
415
  e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (v.error(e.errorMessage), t.splice(t.length - 1, 1)), r.value.formData.file = t;
414
- }, ee = (o, l) => new Promise((t, e) => {
416
+ }, ae = (o, l) => new Promise((t, e) => {
415
417
  const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
416
418
  if (!a.audioAllowedType.includes(i.toUpperCase())) {
417
419
  v.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
@@ -422,21 +424,21 @@ const Ze = /* @__PURE__ */ ue({
422
424
  return;
423
425
  }
424
426
  r.value.additionalData = { file: o }, t(!0);
425
- }), ae = (o, l) => {
427
+ }), oe = (o, l) => {
426
428
  r.value.formData.file = l;
427
- }, oe = (o, l, t) => {
429
+ }, ie = (o, l, t) => {
428
430
  v.error("上传发生错误,请重试!"), r.value.formData.file = t;
429
- }, ie = () => {
430
- var o, l;
431
- return ((l = (o = b.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { file: s.value.additionalData, extParameters: a.extParameters })) || {};
432
431
  }, te = () => {
433
432
  var o, l;
434
- return ((l = (o = b.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { file: s.value.additionalData, extParameters: a.extParameters })) || {};
435
- }, le = (o, l, t) => {
433
+ return ((l = (o = y.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
434
+ }, le = () => {
435
+ var o, l;
436
+ return ((l = (o = y.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
437
+ }, ne = (o, l, t) => {
436
438
  var i, n;
437
- const e = (n = (i = b == null ? void 0 : b.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
439
+ const e = (n = (i = y == null ? void 0 : y.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : n.call(i, o);
438
440
  e != null && e.url ? t[t.length - 1].url = e.url : e != null && e.errorMessage && (v.error(e.errorMessage), t.splice(t.length - 1, 1)), s.value.formData.file = t;
439
- }, ne = (o, l) => new Promise((t, e) => {
441
+ }, re = (o, l) => new Promise((t, e) => {
440
442
  const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
441
443
  if (!a.videoAllowedType.includes(i.toUpperCase())) {
442
444
  v.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
@@ -447,31 +449,31 @@ const Ze = /* @__PURE__ */ ue({
447
449
  return;
448
450
  }
449
451
  s.value.additionalData = { file: o }, t(!0);
450
- }), re = (o, l) => {
452
+ }), se = (o, l) => {
451
453
  s.value.formData.file = l;
452
- }, se = (o, l, t) => {
454
+ }, de = (o, l, t) => {
453
455
  v.error("上传发生错误,请重试!"), s.value.formData.file = t;
454
456
  };
455
- return pe(() => {
457
+ return ce(() => {
456
458
  var o;
457
- (o = u.value) == null || o.destroy();
458
- }), R(() => [a.disabled, u.value], () => {
459
+ (o = d.value) == null || o.destroy();
460
+ }), E(() => [a.disabled, d.value], () => {
459
461
  var o, l;
460
- (l = (o = u.value) == null ? void 0 : o.mode) == null || l.set(a.disabled ? "readonly" : "design");
461
- }, { immediate: !0 }), R(
462
- () => [a.value, a.modelValue, u.value],
462
+ (l = (o = d.value) == null ? void 0 : o.mode) == null || l.set(a.disabled ? "readonly" : "design");
463
+ }, { immediate: !0 }), E(
464
+ () => [a.value, a.modelValue, d.value],
463
465
  () => {
464
466
  var o;
465
467
  if (A.value) {
466
468
  A.value = !1;
467
469
  return;
468
470
  }
469
- U.value = !0, (o = u.value) == null || o.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
471
+ T.value = !0, (o = d.value) == null || o.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
470
472
  },
471
473
  { immediate: !0 }
472
- ), { __sfc: !0, insRef: P, editorRef: u, preventSettingContent: A, preventUpdatingModelValue: U, uploadImage: c, uploadImageFormRef: S, onUploadImageClose: q, onUploadImageConfirm: N, uploadAudio: r, uploadAudioFormRef: k, onUploadAudioConfirm: j, onUploadAudioClose: G, uploadVideo: s, uploadVideoFormRef: z, onUploadVideoConfirm: L, onUploadVideoClose: J, onImageUploadUpload: K, props: a, emits: C, processPastedImage: H, mergeVideoUploadOptions: b, mergeAudioUploadOptions: y, mergeImgPondOptions: Q, paste_preprocess: T, paste_postprocess: V, imageUploadHandle: g, getUploadAudioData: X, getUploadAudioHeaders: Y, onUploadAudioSuccess: Z, onUploadAudioBeforeUpload: ee, onUploadAudioRemove: ae, onUploadAudioError: oe, getUploadVideoData: ie, getUploadVideoHeaders: te, onUploadVideoSuccess: le, onUploadVideoBeforeUpload: ne, onUploadVideoRemove: re, onUploadVideoError: se, ImgPond: ge };
474
+ ), { __sfc: !0, insRef: S, editorRef: d, preventSettingContent: A, preventUpdatingModelValue: T, uploadImage: c, uploadImageFormRef: k, onUploadImageClose: N, onUploadImageConfirm: j, uploadAudio: r, uploadAudioFormRef: z, onUploadAudioConfirm: G, onUploadAudioClose: L, uploadVideo: s, uploadVideoFormRef: H, onUploadVideoConfirm: J, onUploadVideoClose: K, onImageUploadUpload: Q, props: a, emits: C, imgPondAccept: X, processPastedImage: $, mergeVideoUploadOptions: y, mergeAudioUploadOptions: _, mergeImgPondOptions: P, paste_preprocess: U, paste_postprocess: V, imageUploadHandle: g, getUploadAudioData: Y, getUploadAudioHeaders: Z, onUploadAudioSuccess: ee, onUploadAudioBeforeUpload: ae, onUploadAudioRemove: oe, onUploadAudioError: ie, getUploadVideoData: te, getUploadVideoHeaders: le, onUploadVideoSuccess: ne, onUploadVideoBeforeUpload: re, onUploadVideoRemove: se, onUploadVideoError: de, ImgPond: fe };
473
475
  }
474
476
  });
475
477
  export {
476
- Ze as default
478
+ ea as default
477
479
  };
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.07",
5
+ "version": "0.0.12-alpha.09",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",