@keyblade/tinymce-editor-vue2 1.0.1 → 1.0.3

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
@@ -52,11 +52,13 @@ Vue.use(TinymceEditor, {
52
52
  /** 1.x.x版本新增 */
53
53
  action: '/api/man/uploadFile/uploadSingleFile',
54
54
  handlerResponse: (response: any) => {
55
- return {
56
- success: !!response?.data.fileUrl,
57
- url: response?.data.fileUrl,
58
- errorMessage: response?.data.fileUrl ? undefined : response?.msg
59
- }
55
+ return new Promise((resolve) => {
56
+ resolve({
57
+ success: !!response?.data.fileUrl,
58
+ url: response?.data.fileUrl,
59
+ errorMessage: response?.data.fileUrl ? undefined : response?.msg
60
+ })
61
+ })
60
62
  },
61
63
  headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
62
64
  console.log(parameters)
@@ -205,7 +207,9 @@ export interface ImageUploadOptions {
205
207
  accept?: string[];
206
208
  /** 是否支持多选文件 - 默认: true */
207
209
  multiple?: boolean;
208
- /** 最大允许上传个数 - 默认: 10 */
210
+ /** 单次最大限制 - 默认: 10 */
211
+ singleLimit?: number;
212
+ /** 最大允许上传个数 */
209
213
  limit?: number;
210
214
  /** 是否禁用 - 默认: false */
211
215
  disabled?: boolean;
package/es/editor.vue.js CHANGED
@@ -5,7 +5,7 @@ var h = function() {
5
5
  var a = this, o = a._self._c, e = a._self._setupProxy;
6
6
  return o("div", { staticClass: "tinymce-editor" }, [o("textarea", { ref: "insRef" }), o("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-image-dialog", attrs: { visible: e.uploadImage.dialogVisible, title: "插入图片", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: e.onUploadImageClose } }, [o("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: e.uploadImage.formData } }, [o("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [o("kb-pro-vue2-image-upload", a._b({ attrs: { accept: (i = e.mergeImageUploadOptions) == null ? void 0 : i.accept, action: e.mergeImageUploadOptions.action || "", data: e.getUploadImageData(), headers: e.getUploadImageHeaders(), onInnerBeforeUploadEnd: e.onUploadImageInnerBeforeUploadEnd }, model: { value: e.uploadImage.formData.images, callback: function(t) {
7
7
  a.$set(e.uploadImage.formData, "images", t);
8
- }, expression: "uploadImage.formData.images" } }, "kb-pro-vue2-image-upload", e.mergeImageUploadOptions, !1))], 1), o("div", { staticClass: "tips" }, [o("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [a._v("注意:")]), o("span", [a._v("1. 单次最多可同时选择" + a._s(e.mergeImageUploadOptions.limit) + "张图片")]), o("span", [a._v("2. 仅支持" + a._s((s = (l = e.mergeImageUploadOptions) == null ? void 0 : l.accept) == null ? void 0 : s.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("3. 单张图片大小不可超过" + a._s((d = (u = e.mergeImageUploadOptions) == null ? void 0 : u.checkOptions) == null ? void 0 : d.maxSize) + "M")]), o("span", [a._v("4. 像素不低于" + a._s((p = (r = e.mergeImageUploadOptions) == null ? void 0 : r.checkOptions) == null ? void 0 : p.minWidth) + "*" + a._s((m = (n = e.mergeImageUploadOptions) == null ? void 0 : n.checkOptions) == null ? void 0 : m.minHeight) + "且像素不高于" + a._s((g = (c = e.mergeImageUploadOptions) == null ? void 0 : c.checkOptions) == null ? void 0 : g.maxWidth) + "*" + a._s((C = (f = e.mergeImageUploadOptions) == null ? void 0 : f.checkOptions) == null ? void 0 : C.maxHeight))])])], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadImageClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadImageConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: e.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: e.onUploadAudioClose } }, [o("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: e.uploadAudio.formData, "label-width": "auto" } }, [o("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [o("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: e.uploadAudio.formData.name, callback: function(t) {
8
+ }, expression: "uploadImage.formData.images" } }, "kb-pro-vue2-image-upload", e.mergeImageUploadOptions, !1))], 1), o("div", { staticClass: "tips" }, [o("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [a._v("注意:")]), o("span", [a._v("1. 单次最多可同时选择" + a._s(e.mergeImageUploadOptions.singleLimit) + "张图片")]), o("span", [a._v("2. 仅支持" + a._s((s = (l = e.mergeImageUploadOptions) == null ? void 0 : l.accept) == null ? void 0 : s.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("3. 单张图片大小不可超过" + a._s((d = (u = e.mergeImageUploadOptions) == null ? void 0 : u.checkOptions) == null ? void 0 : d.maxSize) + "M")]), o("span", [a._v("4. 像素不低于" + a._s((p = (r = e.mergeImageUploadOptions) == null ? void 0 : r.checkOptions) == null ? void 0 : p.minWidth) + "*" + a._s((m = (n = e.mergeImageUploadOptions) == null ? void 0 : n.checkOptions) == null ? void 0 : m.minHeight) + "且像素不高于" + a._s((g = (c = e.mergeImageUploadOptions) == null ? void 0 : c.checkOptions) == null ? void 0 : g.maxWidth) + "*" + a._s((C = (f = e.mergeImageUploadOptions) == null ? void 0 : f.checkOptions) == null ? void 0 : C.maxHeight))])])], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadImageClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadImageConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: e.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: e.onUploadAudioClose } }, [o("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: e.uploadAudio.formData, "label-width": "auto" } }, [o("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [o("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: e.uploadAudio.formData.name, callback: function(t) {
9
9
  a.$set(e.uploadAudio.formData, "name", t);
10
10
  }, expression: "uploadAudio.formData.name" } })], 1), o("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [o("kb-pro-vue2-image-upload", a._b({ attrs: { accept: (v = e.mergeImageUploadOptions) == null ? void 0 : v.accept, action: e.mergeImageUploadOptions.action || "", data: e.getUploadImageData(), headers: e.getUploadImageHeaders(), onInnerBeforeUploadEnd: e.onUploadImageInnerBeforeUploadEnd, limit: 1, multiple: !1 }, model: { value: e.uploadAudio.formData.cover, callback: function(t) {
11
11
  a.$set(e.uploadAudio.formData, "cover", t);
package/es/editor.vue2.js CHANGED
@@ -88,7 +88,7 @@ const $a = /* @__PURE__ */ Ee({
88
88
  name: S.name,
89
89
  accept: S.accept,
90
90
  multiple: S.multiple,
91
- limit: S.limit,
91
+ singleLimit: S.singleLimit,
92
92
  disabled: S.disabled,
93
93
  hideInnerBeforeUploadLoading: S.hideInnerBeforeUploadLoading,
94
94
  checkOptions: S.checkOptions,
package/es/types.d.ts CHANGED
@@ -8,7 +8,9 @@ export interface ImageUploadOptions {
8
8
  accept?: string[];
9
9
  /** 是否支持多选文件 - 默认: true */
10
10
  multiple?: boolean;
11
- /** 最大允许上传个数 - 默认: 10 */
11
+ /** 单次最大限制 - 默认: 10 */
12
+ singleLimit?: number;
13
+ /** 最大允许上传个数 */
12
14
  limit?: number;
13
15
  /** 是否禁用 - 默认: false */
14
16
  disabled?: boolean;
@@ -33,11 +35,11 @@ export interface ImageUploadOptions {
33
35
  extParameters?: Record<string, any>;
34
36
  }) => Record<string, any>;
35
37
  /** 响应处理(启用必传) */
36
- handlerResponse?: (response: any) => {
38
+ handlerResponse?: (response: any) => Promise<{
37
39
  success: boolean;
38
40
  url?: string;
39
41
  errorMessage?: string;
40
- };
42
+ }>;
41
43
  /** 图片上传请求处理(图片粘贴、复制时调用) */
42
44
  handleRequest?: (file: File, filename: string, options?: {
43
45
  extParameters?: Record<string, any>;
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": "1.0.1",
5
+ "version": "1.0.3",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "es/index.js",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vue": "^2.7.0",
30
- "@keyblade/pro-components-vue2": "^1.12.6"
30
+ "@keyblade/pro-components-vue2": "^1.12.8"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "vite build",