@keyblade/tinymce-editor-vue2 0.0.12-alpha.6 → 0.0.12-alpha.8

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
@@ -33,12 +33,12 @@ Vue.use(PicViewer, {})
33
33
  Vue.use(ImgPond, {})
34
34
 
35
35
  Vue.use(TinymceEditor, {
36
- imageUploadHandle: (file, filename) => {
37
- // const form = new FormData()
38
- // form.append('file', file, filename)
39
- // postRequest('/api/man/uploadFile/uploadSingleFile', form).then((res) => {
40
- // debugger
41
- // })
36
+ 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
42
  return new Promise((resolve) => {
43
43
  setTimeout(() => {
44
44
  resolve({
@@ -51,22 +51,34 @@ Vue.use(TinymceEditor, {
51
51
  // 音频
52
52
  audioUploadOptions: {
53
53
  action: 'https://qt.gcongo.com.cn/msg/file/upload',
54
- headers: {
55
- Appkey: 'dsy_2AeyG8N0CqEC',
56
- Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
54
+ headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
55
+ return {
56
+ Appkey: 'dsy_2AeyG8N0CqEC',
57
+ Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
58
+ }
59
+ },
60
+ data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
61
+ return {}
57
62
  },
58
- handlerResponse: (response) => {
63
+ handlerResponse: (response: any) => {
59
64
  return { url: response.data, errorMessage: response.msg }
60
65
  }
61
66
  },
62
67
  // 视频
63
68
  videoUploadOptions: {
64
69
  action: 'https://qt.gcongo.com.cn/msg/file/upload',
65
- headers: {
66
- Appkey: 'dsy_2AeyG8N0CqEC',
67
- Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
70
+ headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
71
+ return {
72
+ Appkey: 'dsy_2AeyG8N0CqEC',
73
+ Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
74
+ }
75
+ },
76
+ data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
77
+ return {
78
+ a: '1'
79
+ }
68
80
  },
69
- handlerResponse: (response) => {
81
+ handlerResponse: (response: any) => {
70
82
  return { url: response.data, errorMessage: response.msg }
71
83
  }
72
84
  }
@@ -78,6 +90,7 @@ Vue.use(TinymceEditor, {
78
90
  <template>
79
91
  <KbTinymceEditor
80
92
  v-model="text"
93
+ :extParameters="{a: 1}"
81
94
  />
82
95
  </template>
83
96
 
@@ -125,15 +138,15 @@ interface TinymceEditorGlobalOptions {
125
138
  audioUploadOptions?: {
126
139
  action: string;
127
140
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
128
- headers?: Record<string, any>;
129
- data?: Record<string, any>;
141
+ headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
142
+ data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
130
143
  },
131
144
  /** 视频上传选项 */
132
145
  videoUploadOptions?: {
133
146
  action: string;
134
147
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
135
- headers?: Record<string, any>;
136
- data?: Record<string, any>;
148
+ headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
149
+ data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
137
150
  }
138
151
  }
139
152
  ```
@@ -177,8 +190,8 @@ interface ComponentProps {
177
190
  audioUploadOptions?: {
178
191
  action: string;
179
192
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
180
- headers?: Record<string, any>;
181
- data?: Record<string, any>;
193
+ headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
194
+ data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
182
195
  },
183
196
  /** 是否开启视频 */
184
197
  videoEnable?: boolean
@@ -190,8 +203,8 @@ interface ComponentProps {
190
203
  videoUploadOptions?: {
191
204
  action: string;
192
205
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
193
- headers?: Record<string, any>;
194
- data?: Record<string, any>;
206
+ headers?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
207
+ data?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
195
208
  }
196
209
  /** 图片上传请求处理,需要返回图片地址 */
197
210
  imageUploadHandle?: (file: File | Blob, filename: string, options?: {
@@ -40,8 +40,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
40
40
  url?: string;
41
41
  errorMessage?: string;
42
42
  };
43
- headers?: Record<string, any> | undefined;
44
- data?: Record<string, any> | undefined;
43
+ headers?: ((parameters: {
44
+ file: File | Blob;
45
+ extParameters: Record<string, any>;
46
+ }) => Record<string, any>) | undefined;
47
+ data?: ((parameters: {
48
+ file: File | Blob;
49
+ extParameters: Record<string, any>;
50
+ }) => Record<string, any>) | undefined;
45
51
  } | undefined;
46
52
  /** 是否开启视频 */
47
53
  videoEnable?: boolean | undefined;
@@ -56,8 +62,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
56
62
  url?: string;
57
63
  errorMessage?: string;
58
64
  };
59
- headers?: Record<string, any> | undefined;
60
- data?: Record<string, any> | undefined;
65
+ headers?: ((parameters: {
66
+ file: File | Blob;
67
+ extParameters: {};
68
+ }) => Record<string, any>) | undefined;
69
+ data?: ((parameters: {
70
+ file: File | Blob;
71
+ extParameters: {};
72
+ }) => Record<string, any>) | undefined;
61
73
  } | undefined;
62
74
  /** 图片上传请求处理,需要返回图片地址 */
63
75
  imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
@@ -147,8 +159,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
147
159
  url?: string;
148
160
  errorMessage?: string;
149
161
  };
150
- headers?: Record<string, any> | undefined;
151
- data?: Record<string, any> | undefined;
162
+ headers?: ((parameters: {
163
+ file: File | Blob;
164
+ extParameters: Record<string, any>;
165
+ }) => Record<string, any>) | undefined;
166
+ data?: ((parameters: {
167
+ file: File | Blob;
168
+ extParameters: Record<string, any>;
169
+ }) => Record<string, any>) | undefined;
152
170
  } | undefined;
153
171
  /** 是否开启视频 */
154
172
  videoEnable?: boolean | undefined;
@@ -163,8 +181,14 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
163
181
  url?: string;
164
182
  errorMessage?: string;
165
183
  };
166
- headers?: Record<string, any> | undefined;
167
- data?: Record<string, any> | undefined;
184
+ headers?: ((parameters: {
185
+ file: File | Blob;
186
+ extParameters: {};
187
+ }) => Record<string, any>) | undefined;
188
+ data?: ((parameters: {
189
+ file: File | Blob;
190
+ extParameters: {};
191
+ }) => Record<string, any>) | undefined;
168
192
  } | undefined;
169
193
  /** 图片上传请求处理,需要返回图片地址 */
170
194
  imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
package/es/editor.vue.js CHANGED
@@ -1,8 +1,8 @@
1
- import d from "./editor.vue2.js";
1
+ import u from "./editor.vue2.js";
2
2
  import "./editor.vue3.js";
3
- import s from "./_virtual/_plugin-vue2_normalizer.js";
4
- var r = function() {
5
- var l, i, u;
3
+ import i from "./_virtual/_plugin-vue2_normalizer.js";
4
+ var d = function() {
5
+ var l;
6
6
  var e = this, a = e._self._c, o = e._self._setupProxy;
7
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) {
8
8
  e.$set(o.uploadImage.formData, "images", t);
@@ -10,13 +10,13 @@ var r = function() {
10
10
  e.$set(o.uploadAudio.formData, "name", t);
11
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) {
12
12
  e.$set(o.uploadAudio.formData, "cover", t);
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: (i = o.mergeAudioUploadOptions) == null ? void 0 : i.data, accept: "audio/*", "list-type": "headTextContent", "before-upload": o.onUploadAudioBeforeUpload, headers: (u = o.mergeAudioUploadOptions) == null ? void 0 : u.headers, "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.mergeVideoUploadOptions.data, accept: "video/*", "list-type": "headTextContent", "before-upload": o.onUploadVideoBeforeUpload, headers: o.mergeVideoUploadOptions.headers, "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
- }, p = [], n = /* @__PURE__ */ s(
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
+ }, s = [], r = /* @__PURE__ */ i(
15
+ u,
15
16
  d,
16
- r,
17
- p
17
+ s
18
18
  );
19
- const F = n.exports;
19
+ const f = r.exports;
20
20
  export {
21
- F as default
21
+ f as default
22
22
  };
package/es/editor.vue2.js CHANGED
@@ -1,9 +1,9 @@
1
- import { defineComponent as ne, ref as u, computed as y, onMounted as re, onUnmounted as se, watch as E } from "vue";
2
- import { oneTravelImageCheck as B, oneTravelImageCompressor as O, getImagePixel as me } from "./util.js";
3
- import de from "imgpond";
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
4
  import { conclude as M } from "vue-global-config";
5
5
  import I from "tinymce";
6
- import ue from "./langs/zh_CN.js";
6
+ import fe 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";
@@ -33,8 +33,8 @@ import "tinymce/plugins/visualblocks";
33
33
  import "tinymce/plugins/visualchars";
34
34
  import "tinymce/plugins/wordcount";
35
35
  import { globalProps as x } from "./index.js";
36
- import { Loading as pe, Message as f } from "element-ui";
37
- const Qe = /* @__PURE__ */ ne({
36
+ import { Loading as ve, Message as v } from "element-ui";
37
+ const Ze = /* @__PURE__ */ ue({
38
38
  __name: "editor",
39
39
  props: {
40
40
  value: { default: "" },
@@ -66,27 +66,27 @@ const Qe = /* @__PURE__ */ ne({
66
66
  imgPondOptions: null
67
67
  },
68
68
  emits: ["input", "update:modelValue"],
69
- setup(F, { emit: S }) {
69
+ setup(F, { emit: C }) {
70
70
  const a = F;
71
- I.addI18n("zh_CN", ue);
72
- const z = u(), m = u(), _ = u(!1), w = u(!1), v = u({
71
+ I.addI18n("zh_CN", fe);
72
+ const P = m(), u = m(), A = m(!1), U = m(!1), c = m({
73
73
  dialogVisible: !1,
74
74
  formData: {
75
75
  images: []
76
76
  }
77
- }), P = u(), N = () => {
78
- v.value.dialogVisible = !1, v.value.formData = {
77
+ }), S = m(), q = () => {
78
+ c.value.dialogVisible = !1, c.value.formData = {
79
79
  images: []
80
80
  };
81
- }, q = () => {
82
- var t;
83
- (t = P.value) == null || t.validate((n) => {
84
- n && (v.value.formData.images.forEach((o) => {
81
+ }, N = () => {
82
+ var o;
83
+ (o = S.value) == null || o.validate((l) => {
84
+ l && (c.value.formData.images.forEach((t) => {
85
85
  var e;
86
- (e = m.value) == null || e.insertContent(`<img src=${o} alt="" />`);
87
- }), v.value.dialogVisible = !1, v.value.formData.images = []);
86
+ (e = u.value) == null || e.insertContent(`<img src=${t} alt="" />`);
87
+ }), c.value.dialogVisible = !1, c.value.formData.images = []);
88
88
  });
89
- }, r = u({
89
+ }, r = m({
90
90
  dialogVisible: !1,
91
91
  formData: {
92
92
  // 名称
@@ -95,44 +95,48 @@ const Qe = /* @__PURE__ */ ne({
95
95
  cover: [],
96
96
  // 文件
97
97
  file: []
98
- }
99
- }), k = u(), j = () => {
100
- var t;
101
- (t = k.value) == null || t.validate((n) => {
102
- var o, e;
103
- n && ((e = m.value) == null || e.insertContent(`<audio controls data-name="${r.value.formData.name}" data-poster="${r.value.formData.cover[0]}" src="${(o = r.value.formData.file[0]) == null ? void 0 : o.url}"></audio>`), r.value.dialogVisible = !1, r.value.formData = {
98
+ },
99
+ // 用于临时保存上传前的参数 { file: File }
100
+ additionalData: {}
101
+ }), k = m(), j = () => {
102
+ var o;
103
+ (o = k.value) == null || o.validate((l) => {
104
+ 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 = {
104
106
  name: "",
105
107
  cover: [],
106
108
  file: []
107
- });
109
+ }, r.value.additionalData = {});
108
110
  });
109
111
  }, G = () => {
110
112
  r.value.dialogVisible = !1, r.value.formData = {
111
113
  name: "",
112
114
  cover: [],
113
115
  file: []
114
- };
115
- }, d = u({
116
+ }, r.value.additionalData = {};
117
+ }, s = m({
116
118
  dialogVisible: !1,
117
119
  formData: {
118
120
  // 文件
119
121
  file: []
120
- }
121
- }), W = u(), J = () => {
122
- var t;
123
- (t = W.value) == null || t.validate((n) => {
124
- var o, e;
125
- n && ((e = m.value) == null || e.insertContent(`<video controls controlslist="nodownload" src="${(o = d.value.formData.file[0]) == null ? void 0 : o.url}"></video>`), d.value.dialogVisible = !1, d.value.formData = {
122
+ },
123
+ // 用于临时保存上传前的参数 { file: File }
124
+ additionalData: {}
125
+ }), z = m(), L = () => {
126
+ var o;
127
+ (o = z.value) == null || o.validate((l) => {
128
+ 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 = {
126
130
  file: []
127
- });
131
+ }, s.value.additionalData = {});
128
132
  });
129
- }, K = () => {
130
- d.value.dialogVisible = !1, d.value.formData = {
133
+ }, J = () => {
134
+ s.value.dialogVisible = !1, s.value.formData = {
131
135
  file: []
132
- };
133
- }, Q = (t, n) => new Promise(async (o, e) => {
136
+ }, s.value.additionalData = {};
137
+ }, K = (o, l) => new Promise(async (t, e) => {
134
138
  var h;
135
- const i = await B(t, {
139
+ const i = await E(o, {
136
140
  imageMaxSize: a.imageMaxSize,
137
141
  imageAllowedMineType: a.imageAllowedMineType,
138
142
  imageMinWidth: a.imageMinWidth,
@@ -142,39 +146,39 @@ const Qe = /* @__PURE__ */ ne({
142
146
  });
143
147
  if (!i.success) {
144
148
  e(), setTimeout(() => {
145
- var p, g, b;
146
- (p = i.error) != null && p.size ? n.onError(`请上传大小不超过${a.imageMaxSize}M的图片`) : (g = i.error) != null && g.format ? n.onError(`请上传格式为${a.imageAllowedType.map((V) => V.toUpperCase()).join("、")}的图片`) : (b = i.error) != null && b.pixel && n.onError(`请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`);
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}的图片`);
147
151
  });
148
152
  return;
149
153
  }
150
- const l = await O(t);
151
- if (!l.success) {
154
+ const n = await O(o);
155
+ if (!n.success) {
152
156
  e(), setTimeout(() => {
153
- n.onError(l.errorMessage);
157
+ l.onError(n.errorMessage);
154
158
  });
155
159
  return;
156
160
  }
157
- const s = await ((h = c.value) == null ? void 0 : h.call(c, l.file, t.name, { extParameters: a.extParameters }));
158
- if (!s.success) {
161
+ const d = await ((h = g.value) == null ? void 0 : h.call(g, n.file, o.name, { extParameters: a.extParameters }));
162
+ if (!d.success) {
159
163
  e(), setTimeout(() => {
160
- n.onError(s.errorMessage);
164
+ l.onError(d.errorMessage);
161
165
  });
162
166
  return;
163
167
  }
164
- o(s.url);
168
+ t(d.url);
165
169
  });
166
- async function $(t) {
167
- var o, e;
168
- const n = t.getElementsByTagName("img");
169
- for (let i of n) {
170
- const l = i.src;
171
- if (l.startsWith("http://") || l.startsWith("https://")) {
172
- const s = await me(l);
173
- if (s.width < a.imageMinWidth && s.height < a.imageMinHeight || s.width > a.imageMaxWidth && s.height > a.imageMaxHeight) {
174
- (o = i == null ? void 0 : i.remove) == null || o.call(i);
170
+ async function H(o) {
171
+ var t, e;
172
+ const l = o.getElementsByTagName("img");
173
+ for (let i of l) {
174
+ const n = i.src;
175
+ 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
+ (t = i == null ? void 0 : i.remove) == null || t.call(i);
175
179
  return;
176
180
  }
177
- const h = l.split("."), p = h[h.length - 1].toLowerCase();
181
+ const h = n.split("."), p = h[h.length - 1].toLowerCase();
178
182
  if (!a.imageAllowedType.includes(p)) {
179
183
  (e = i == null ? void 0 : i.remove) == null || e.call(i);
180
184
  return;
@@ -182,25 +186,25 @@ const Qe = /* @__PURE__ */ ne({
182
186
  }
183
187
  }
184
188
  }
185
- const A = y(() => M([a.videoUploadOptions, x.videoUploadOptions]) || {}), U = y(() => M([a.audioUploadOptions, x.audioUploadOptions]) || {}), X = y(() => M([a.imgPondOptions, x.imgPondOptions]) || {}), C = y(
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(
186
190
  () => M([a.paste_preprocess, x.paste_preprocess], {
187
191
  type: Function
188
192
  })
189
- ), T = y(
193
+ ), V = w(
190
194
  () => M([a.paste_postprocess, x.paste_postprocess], {
191
195
  type: Function
192
196
  })
193
- ), c = y(
197
+ ), g = w(
194
198
  () => M([a.imageUploadHandle, x.imageUploadHandle], {
195
199
  type: Function
196
200
  })
197
201
  );
198
- re(() => {
199
- const t = {
202
+ me(() => {
203
+ const o = {
200
204
  // 设置语言
201
205
  language: "zh_CN",
202
206
  // 实例
203
- target: z.value,
207
+ target: P.value,
204
208
  // 隐藏品牌
205
209
  branding: !1,
206
210
  // 隐藏右上角升级按钮
@@ -255,12 +259,13 @@ const Qe = /* @__PURE__ */ ne({
255
259
  ],
256
260
  menu: {
257
261
  insert: {
258
- title: "菜单",
262
+ title: "插入",
259
263
  items: "localImage localAudio localVideo | link mobilelink | template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime"
260
264
  }
261
265
  },
266
+ toolbar_mode: "sliding",
262
267
  // 工具栏
263
- toolbar: "undo redo | bold italic underline strikethrough | fontfamily fontsize styles | alignleft aligncenter alignright alignjustify | outdent indent",
268
+ 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",
264
269
  // 改动后刷新,不再弹 alert
265
270
  autosave_ask_before_unload: !1,
266
271
  // 内容样式 data-mce-bogus="all" 音频点击会出现另外一个
@@ -275,22 +280,22 @@ const Qe = /* @__PURE__ */ ne({
275
280
  paste_webkit_styles: "all",
276
281
  paste_data_images: !0,
277
282
  // 粘贴前处理
278
- paste_preprocess(o, e) {
283
+ paste_preprocess(t, e) {
279
284
  var i;
280
- 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 = C.value) == null || i.call(C, o, e);
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);
281
286
  },
282
287
  // 粘贴后处理(处理异步操作)
283
- paste_postprocess(o, e) {
284
- var l;
288
+ paste_postprocess(t, e) {
289
+ var n;
285
290
  const i = e.node;
286
- $(i), (l = T.value) == null || l.call(T, o, e);
291
+ H(i), (n = V.value) == null || n.call(V, t, e);
287
292
  },
288
- images_upload_handler(o) {
293
+ images_upload_handler(t) {
289
294
  return new Promise(async (e, i) => {
290
- var V, D, H, R;
291
- const l = pe.service({ text: "上传中" });
292
- let s = o.blob();
293
- const h = o.filename(), p = await B(s, {
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, {
294
299
  imageMaxSize: a.imageMaxSize,
295
300
  imageAllowedMineType: a.imageAllowedMineType,
296
301
  imageMinWidth: a.imageMinWidth,
@@ -299,36 +304,46 @@ const Qe = /* @__PURE__ */ ne({
299
304
  imageMaxHeight: a.imageMaxHeight
300
305
  });
301
306
  if (!p.success) {
302
- if (l == null || l.close(), (V = p.error) != null && V.size)
307
+ if (n == null || n.close(), (D = p.error) != null && D.size)
303
308
  return i({ message: `请上传大小不超过${a.imageMaxSize}M的图片`, remove: !0 });
304
- if ((D = p.error) != null && D.format)
305
- return i({ message: `请上传格式为${a.imageAllowedType.map((le) => le.toUpperCase()).join("、")}的图片`, remove: !0 });
306
- if ((H = p.error) != null && H.pixel)
309
+ 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)
307
312
  return i({ message: `请上传像素不低于${a.imageMinWidth}*${a.imageMinHeight}且像素不高于${a.imageMaxWidth}*${a.imageMaxHeight}的图片`, remove: !0 });
308
313
  }
309
- const g = await O(s);
310
- if (!g.success)
311
- return l == null || l.close(), i({ message: g == null ? void 0 : g.errorMessage, remove: !0 });
312
- if (!c.value)
313
- return l == null || l.close(), i({ message: "缺少图片上传配置", remove: !0 });
314
- const b = await ((R = c.value) == null ? void 0 : R.call(c, g.file, h, { extParameters: a.extParameters }));
315
- if (!b.success)
316
- return l == null || l.close(), i({ message: b.errorMessage, remove: !0 });
317
- l == null || l.close(), e(b.url);
314
+ const f = await O(d);
315
+ if (!f.success)
316
+ return n == null || n.close(), i({ message: f == null ? void 0 : f.errorMessage, remove: !0 });
317
+ if (!g.value)
318
+ 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);
318
323
  });
319
324
  },
320
- setup(o) {
321
- o.ui.registry.addMenuItem("localImage", {
325
+ setup(t) {
326
+ t.ui.registry.addMenuItem("localImage", {
322
327
  text: "图片",
323
328
  icon: "image",
324
329
  onAction: () => {
325
- v.value.dialogVisible = !0, setTimeout(() => {
330
+ c.value.dialogVisible = !0, setTimeout(() => {
326
331
  var i;
327
332
  const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
328
333
  e && (e.innerHTML = a.imageUploadTip || "上传");
329
334
  });
330
335
  }
331
- }), a.audioEnable && o.ui.registry.addMenuItem("localAudio", {
336
+ }), t.ui.registry.addButton("localImage", {
337
+ icon: "image",
338
+ tooltip: "图片",
339
+ onAction: () => {
340
+ c.value.dialogVisible = !0, setTimeout(() => {
341
+ var i;
342
+ const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-image-dialog .el-upload__text > div");
343
+ e && (e.innerHTML = a.imageUploadTip || "上传");
344
+ });
345
+ }
346
+ }), a.audioEnable && (t.ui.registry.addMenuItem("localAudio", {
332
347
  text: "音频",
333
348
  icon: "arrow-right",
334
349
  onAction: () => {
@@ -338,97 +353,125 @@ const Qe = /* @__PURE__ */ ne({
338
353
  e && (e.innerHTML = a.imageUploadTip || "上传");
339
354
  });
340
355
  }
341
- }), a.videoEnable && o.ui.registry.addMenuItem("localVideo", {
356
+ }), t.ui.registry.addButton("localAudio", {
357
+ icon: "arrow-right",
358
+ tooltip: "音频",
359
+ onAction: () => {
360
+ r.value.dialogVisible = !0, setTimeout(() => {
361
+ var i;
362
+ const e = (i = document == null ? void 0 : document.querySelector) == null ? void 0 : i.call(document, ".tinymce-editor-upload-audio-dialog .el-upload__text > div");
363
+ e && (e.innerHTML = a.imageUploadTip || "上传");
364
+ });
365
+ }
366
+ })), a.videoEnable && (t.ui.registry.addMenuItem("localVideo", {
342
367
  text: "视频",
343
368
  icon: "embed",
344
369
  onAction: () => {
345
- d.value.dialogVisible = !0;
370
+ s.value.dialogVisible = !0;
346
371
  }
347
- });
372
+ }), t.ui.registry.addButton("localVideo", {
373
+ icon: "embed",
374
+ tooltip: "视频",
375
+ onAction: () => {
376
+ s.value.dialogVisible = !0;
377
+ }
378
+ }));
348
379
  }
349
- }, n = M(
380
+ }, l = M(
350
381
  [
351
382
  a.options,
352
383
  x.tinymceOptions,
353
- t
384
+ o
354
385
  ],
355
386
  {
356
- mergeFunction: (o, e) => (...i) => {
357
- o(...i), e(...i);
387
+ mergeFunction: (t, e) => (...i) => {
388
+ t(...i), e(...i);
358
389
  },
359
390
  type: Object
360
391
  }
361
392
  );
362
- I.init(n).then(([o]) => {
393
+ I.init(l).then(([t]) => {
363
394
  var e;
364
- o && (o.customProps = { ...a }, o.on("change input Redo Undo SetContent", () => {
365
- if (w.value) {
366
- w.value = !1;
395
+ t && (t.customProps = { ...a }, t.on("change input Redo Undo SetContent", () => {
396
+ if (U.value) {
397
+ U.value = !1;
367
398
  return;
368
399
  }
369
- _.value = !0, S("input", o.getContent()), S("update:modelValue", o.getContent());
370
- }), (e = a.initComplete) == null || e.call(a, { editorIns: o }), m.value = o);
400
+ 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);
371
402
  });
372
403
  });
373
- const Y = (t, n, o) => {
374
- var i, l;
375
- const e = (l = (i = U == null ? void 0 : U.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : l.call(i, t);
376
- e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), o.splice(o.length - 1, 1)), r.value.formData.file = o;
377
- }, Z = (t, n) => new Promise((o, e) => {
378
- const i = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
404
+ const X = () => {
405
+ var o, l;
406
+ return ((l = (o = y.value) == null ? void 0 : o.data) == null ? void 0 : l.call(o, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
407
+ }, Y = () => {
408
+ var o, l;
409
+ return ((l = (o = y.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { ...r.value.additionalData || {}, extParameters: a.extParameters })) || {};
410
+ }, Z = (o, l, t) => {
411
+ 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);
413
+ 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) => {
415
+ const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
379
416
  if (!a.audioAllowedType.includes(i.toUpperCase())) {
380
- f.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
417
+ v.info(`请上传格式为${a.audioAllowedType.join("、")}的音频`), e();
381
418
  return;
382
419
  }
383
- if (t.size > a.audioMaxSize * 1024 * 1024) {
384
- f.info(`请上传${a.audioMaxSize}M内的音频`), e();
420
+ if (o.size > a.audioMaxSize * 1024 * 1024) {
421
+ v.info(`请上传${a.audioMaxSize}M内的音频`), e();
385
422
  return;
386
423
  }
387
- o(!0);
388
- }), L = (t, n) => {
389
- r.value.formData.file = n;
390
- }, ee = (t, n, o) => {
391
- f.error("上传发生错误,请重试!"), r.value.formData.file = o;
392
- }, ae = (t, n, o) => {
393
- var i, l;
394
- const e = (l = (i = A == null ? void 0 : A.value) == null ? void 0 : i.handlerResponse) == null ? void 0 : l.call(i, t);
395
- e != null && e.url ? o[o.length - 1].url = e.url : e != null && e.errorMessage && (f.error(e.errorMessage), o.splice(o.length - 1, 1)), d.value.formData.file = o;
396
- }, oe = (t, n) => new Promise((o, e) => {
397
- const i = t.name.split(".").filter(Boolean).pop() ? t.name.split(".").filter(Boolean).pop() : "";
424
+ r.value.additionalData = { file: o }, t(!0);
425
+ }), ae = (o, l) => {
426
+ r.value.formData.file = l;
427
+ }, oe = (o, l, t) => {
428
+ 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, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
432
+ }, te = () => {
433
+ var o, l;
434
+ return ((l = (o = b.value) == null ? void 0 : o.headers) == null ? void 0 : l.call(o, { ...s.value.additionalData || {}, extParameters: a.extParameters })) || {};
435
+ }, le = (o, l, t) => {
436
+ 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);
438
+ 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) => {
440
+ const i = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
398
441
  if (!a.videoAllowedType.includes(i.toUpperCase())) {
399
- f.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
442
+ v.info(`请上传格式为${a.videoAllowedType.join("、")}的视频`), e();
400
443
  return;
401
444
  }
402
- if (t.size > a.videoMaxSize * 1024 * 1024) {
403
- f.info(`请上传${a.videoMaxSize}M内的视频`), e();
445
+ if (o.size > a.videoMaxSize * 1024 * 1024) {
446
+ v.info(`请上传${a.videoMaxSize}M内的视频`), e();
404
447
  return;
405
448
  }
406
- o(!0);
407
- }), ie = (t, n) => {
408
- d.value.formData.file = n;
409
- }, te = (t, n, o) => {
410
- f.error("上传发生错误,请重试!"), d.value.formData.file = o;
449
+ s.value.additionalData = { file: o }, t(!0);
450
+ }), re = (o, l) => {
451
+ s.value.formData.file = l;
452
+ }, se = (o, l, t) => {
453
+ v.error("上传发生错误,请重试!"), s.value.formData.file = t;
411
454
  };
412
- return se(() => {
413
- var t;
414
- (t = m.value) == null || t.destroy();
415
- }), E(() => [a.disabled, m.value], () => {
416
- var t, n;
417
- (n = (t = m.value) == null ? void 0 : t.mode) == null || n.set(a.disabled ? "readonly" : "design");
418
- }, { immediate: !0 }), E(
419
- () => [a.value, a.modelValue, m.value],
455
+ return pe(() => {
456
+ var o;
457
+ (o = u.value) == null || o.destroy();
458
+ }), R(() => [a.disabled, u.value], () => {
459
+ 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],
420
463
  () => {
421
- var t;
422
- if (_.value) {
423
- _.value = !1;
464
+ var o;
465
+ if (A.value) {
466
+ A.value = !1;
424
467
  return;
425
468
  }
426
- w.value = !0, (t = m.value) == null || t.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
469
+ U.value = !0, (o = u.value) == null || o.setContent(a.value ? a.value : a.modelValue ? a.modelValue : "");
427
470
  },
428
471
  { immediate: !0 }
429
- ), { __sfc: !0, insRef: z, editorRef: m, preventSettingContent: _, preventUpdatingModelValue: w, uploadImage: v, uploadImageFormRef: P, onUploadImageClose: N, onUploadImageConfirm: q, uploadAudio: r, uploadAudioFormRef: k, onUploadAudioConfirm: j, onUploadAudioClose: G, uploadVideo: d, uploadVideoFormRef: W, onUploadVideoConfirm: J, onUploadVideoClose: K, onImageUploadUpload: Q, props: a, emits: S, processPastedImage: $, mergeVideoUploadOptions: A, mergeAudioUploadOptions: U, mergeImgPondOptions: X, paste_preprocess: C, paste_postprocess: T, imageUploadHandle: c, onUploadAudioSuccess: Y, onUploadAudioBeforeUpload: Z, onUploadAudioRemove: L, onUploadAudioError: ee, onUploadVideoSuccess: ae, onUploadVideoBeforeUpload: oe, onUploadVideoRemove: ie, onUploadVideoError: te, ImgPond: de };
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 };
430
473
  }
431
474
  });
432
475
  export {
433
- Qe as default
476
+ Ze as default
434
477
  };
package/es/index.d.ts CHANGED
@@ -29,8 +29,14 @@ interface TinymceEditorGlobalOptions {
29
29
  url?: string;
30
30
  errorMessage?: string;
31
31
  };
32
- headers?: Record<string, any>;
33
- data?: Record<string, any>;
32
+ headers?: (parameters: {
33
+ file: File | Blob;
34
+ extParameters: Record<string, any>;
35
+ }) => Record<string, any>;
36
+ data?: (parameters: {
37
+ file: File | Blob;
38
+ extParameters: Record<string, any>;
39
+ }) => Record<string, any>;
34
40
  };
35
41
  /** 视频上传选项 */
36
42
  videoUploadOptions?: {
@@ -39,8 +45,14 @@ interface TinymceEditorGlobalOptions {
39
45
  url?: string;
40
46
  errorMessage?: string;
41
47
  };
42
- headers?: Record<string, any>;
43
- data?: Record<string, any>;
48
+ headers?: (parameters: {
49
+ file: File | Blob;
50
+ extParameters: Record<string, any>;
51
+ }) => Record<string, any>;
52
+ data?: (parameters: {
53
+ file: File | Blob;
54
+ extParameters: Record<string, any>;
55
+ }) => Record<string, any>;
44
56
  };
45
57
  }
46
58
  declare const globalProps: TinymceEditorGlobalOptions;
@@ -114,8 +126,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
114
126
  url?: string | undefined;
115
127
  errorMessage?: string | undefined;
116
128
  };
117
- headers?: Record<string, any> | undefined;
118
- data?: Record<string, any> | undefined;
129
+ headers?: ((parameters: {
130
+ file: File | Blob;
131
+ extParameters: Record<string, any>;
132
+ }) => Record<string, any>) | undefined;
133
+ data?: ((parameters: {
134
+ file: File | Blob;
135
+ extParameters: Record<string, any>;
136
+ }) => Record<string, any>) | undefined;
119
137
  }>;
120
138
  };
121
139
  videoEnable: {
@@ -137,8 +155,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
137
155
  url?: string | undefined;
138
156
  errorMessage?: string | undefined;
139
157
  };
140
- headers?: Record<string, any> | undefined;
141
- data?: Record<string, any> | undefined;
158
+ headers?: ((parameters: {
159
+ file: File | Blob;
160
+ extParameters: {};
161
+ }) => Record<string, any>) | undefined;
162
+ data?: ((parameters: {
163
+ file: File | Blob;
164
+ extParameters: {};
165
+ }) => Record<string, any>) | undefined;
142
166
  }>;
143
167
  };
144
168
  imageUploadHandle: {
@@ -244,8 +268,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
244
268
  url?: string | undefined;
245
269
  errorMessage?: string | undefined;
246
270
  };
247
- headers?: Record<string, any> | undefined;
248
- data?: Record<string, any> | undefined;
271
+ headers?: ((parameters: {
272
+ file: File | Blob;
273
+ extParameters: Record<string, any>;
274
+ }) => Record<string, any>) | undefined;
275
+ data?: ((parameters: {
276
+ file: File | Blob;
277
+ extParameters: Record<string, any>;
278
+ }) => Record<string, any>) | undefined;
249
279
  }>;
250
280
  };
251
281
  videoEnable: {
@@ -267,8 +297,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
267
297
  url?: string | undefined;
268
298
  errorMessage?: string | undefined;
269
299
  };
270
- headers?: Record<string, any> | undefined;
271
- data?: Record<string, any> | undefined;
300
+ headers?: ((parameters: {
301
+ file: File | Blob;
302
+ extParameters: {};
303
+ }) => Record<string, any>) | undefined;
304
+ data?: ((parameters: {
305
+ file: File | Blob;
306
+ extParameters: {};
307
+ }) => Record<string, any>) | undefined;
272
308
  }>;
273
309
  };
274
310
  imageUploadHandle: {
@@ -396,8 +432,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
396
432
  url?: string | undefined;
397
433
  errorMessage?: string | undefined;
398
434
  };
399
- headers?: Record<string, any> | undefined;
400
- data?: Record<string, any> | undefined;
435
+ headers?: ((parameters: {
436
+ file: File | Blob;
437
+ extParameters: Record<string, any>;
438
+ }) => Record<string, any>) | undefined;
439
+ data?: ((parameters: {
440
+ file: File | Blob;
441
+ extParameters: Record<string, any>;
442
+ }) => Record<string, any>) | undefined;
401
443
  }>;
402
444
  };
403
445
  videoEnable: {
@@ -419,8 +461,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
419
461
  url?: string | undefined;
420
462
  errorMessage?: string | undefined;
421
463
  };
422
- headers?: Record<string, any> | undefined;
423
- data?: Record<string, any> | undefined;
464
+ headers?: ((parameters: {
465
+ file: File | Blob;
466
+ extParameters: {};
467
+ }) => Record<string, any>) | undefined;
468
+ data?: ((parameters: {
469
+ file: File | Blob;
470
+ extParameters: {};
471
+ }) => Record<string, any>) | undefined;
424
472
  }>;
425
473
  };
426
474
  imageUploadHandle: {
@@ -526,8 +574,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
526
574
  url?: string | undefined;
527
575
  errorMessage?: string | undefined;
528
576
  };
529
- headers?: Record<string, any> | undefined;
530
- data?: Record<string, any> | undefined;
577
+ headers?: ((parameters: {
578
+ file: File | Blob;
579
+ extParameters: Record<string, any>;
580
+ }) => Record<string, any>) | undefined;
581
+ data?: ((parameters: {
582
+ file: File | Blob;
583
+ extParameters: Record<string, any>;
584
+ }) => Record<string, any>) | undefined;
531
585
  }>;
532
586
  };
533
587
  videoEnable: {
@@ -549,8 +603,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
549
603
  url?: string | undefined;
550
604
  errorMessage?: string | undefined;
551
605
  };
552
- headers?: Record<string, any> | undefined;
553
- data?: Record<string, any> | undefined;
606
+ headers?: ((parameters: {
607
+ file: File | Blob;
608
+ extParameters: {};
609
+ }) => Record<string, any>) | undefined;
610
+ data?: ((parameters: {
611
+ file: File | Blob;
612
+ extParameters: {};
613
+ }) => Record<string, any>) | undefined;
554
614
  }>;
555
615
  };
556
616
  imageUploadHandle: {
@@ -656,8 +716,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
656
716
  url?: string | undefined;
657
717
  errorMessage?: string | undefined;
658
718
  };
659
- headers?: Record<string, any> | undefined;
660
- data?: Record<string, any> | undefined;
719
+ headers?: ((parameters: {
720
+ file: File | Blob;
721
+ extParameters: Record<string, any>;
722
+ }) => Record<string, any>) | undefined;
723
+ data?: ((parameters: {
724
+ file: File | Blob;
725
+ extParameters: Record<string, any>;
726
+ }) => Record<string, any>) | undefined;
661
727
  }>;
662
728
  };
663
729
  videoEnable: {
@@ -679,8 +745,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
679
745
  url?: string | undefined;
680
746
  errorMessage?: string | undefined;
681
747
  };
682
- headers?: Record<string, any> | undefined;
683
- data?: Record<string, any> | undefined;
748
+ headers?: ((parameters: {
749
+ file: File | Blob;
750
+ extParameters: {};
751
+ }) => Record<string, any>) | undefined;
752
+ data?: ((parameters: {
753
+ file: File | Blob;
754
+ extParameters: {};
755
+ }) => Record<string, any>) | undefined;
684
756
  }>;
685
757
  };
686
758
  imageUploadHandle: {
@@ -809,8 +881,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
809
881
  url?: string | undefined;
810
882
  errorMessage?: string | undefined;
811
883
  };
812
- headers?: Record<string, any> | undefined;
813
- data?: Record<string, any> | undefined;
884
+ headers?: ((parameters: {
885
+ file: File | Blob;
886
+ extParameters: Record<string, any>;
887
+ }) => Record<string, any>) | undefined;
888
+ data?: ((parameters: {
889
+ file: File | Blob;
890
+ extParameters: Record<string, any>;
891
+ }) => Record<string, any>) | undefined;
814
892
  }>;
815
893
  };
816
894
  videoEnable: {
@@ -832,8 +910,14 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
832
910
  url?: string | undefined;
833
911
  errorMessage?: string | undefined;
834
912
  };
835
- headers?: Record<string, any> | undefined;
836
- data?: Record<string, any> | undefined;
913
+ headers?: ((parameters: {
914
+ file: File | Blob;
915
+ extParameters: {};
916
+ }) => Record<string, any>) | undefined;
917
+ data?: ((parameters: {
918
+ file: File | Blob;
919
+ extParameters: {};
920
+ }) => Record<string, any>) | undefined;
837
921
  }>;
838
922
  };
839
923
  imageUploadHandle: {
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.06",
5
+ "version": "0.0.12-alpha.08",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
package/src/index.ts CHANGED
@@ -26,15 +26,15 @@ interface TinymceEditorGlobalOptions {
26
26
  audioUploadOptions?: {
27
27
  action: string;
28
28
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
29
- headers?: Record<string, any>;
30
- data?: Record<string, any>;
29
+ headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
30
+ data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
31
31
  },
32
32
  /** 视频上传选项 */
33
33
  videoUploadOptions?: {
34
34
  action: string;
35
35
  handlerResponse: (response: any) => { url?: string; errorMessage?: string }
36
- headers?: Record<string, any>;
37
- data?: Record<string, any>;
36
+ headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
37
+ data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
38
38
  }
39
39
  }
40
40