@keyblade/tinymce-editor-vue2 1.2.0 → 1.2.2

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.
@@ -1,10 +1,10 @@
1
- function u(e, o, t, i, a, d, f, l) {
1
+ function f(e, o, t, d, i, a, l, u) {
2
2
  var n = typeof e == "function" ? e.options : e;
3
- return o && (n.render = o, n.staticRenderFns = t, n._compiled = !0), {
3
+ return n.render = o, n.staticRenderFns = t, n._compiled = !0, {
4
4
  exports: e,
5
5
  options: n
6
6
  };
7
7
  }
8
8
  export {
9
- u as default
9
+ f as default
10
10
  };
@@ -1,65 +1,49 @@
1
1
  import { Editor, RawEditorOptions } from 'tinymce';
2
2
  import { AudioUploadOptions, ImageUploadOptions, VideoUploadOptions } from './types';
3
-
4
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ type __VLS_Props = {
5
4
  /** vue2 v-model */
6
- value?: string | undefined;
5
+ value?: string;
7
6
  /** 是否禁止编辑 */
8
- disabled?: boolean | undefined;
7
+ disabled?: boolean;
9
8
  /** 额外参数 */
10
- extParameters?: Record<string, any> | undefined;
9
+ extParameters?: Record<string, any>;
11
10
  /** 富文本编辑器选项 */
12
- options?: Partial<RawEditorOptions> | undefined;
11
+ options?: Partial<RawEditorOptions>;
13
12
  /** 图片上传选项 */
14
- imageUploadOptions?: ImageUploadOptions | undefined;
13
+ imageUploadOptions?: ImageUploadOptions;
15
14
  /** 音频上传组件选项 */
16
- audioUploadOptions?: AudioUploadOptions | undefined;
15
+ audioUploadOptions?: AudioUploadOptions;
17
16
  /** 视频上传选项 */
18
- videoUploadOptions?: VideoUploadOptions | undefined;
17
+ videoUploadOptions?: VideoUploadOptions;
19
18
  /** 初始化完成 */
20
- initComplete?: ((params: {
19
+ initComplete?: (params: {
21
20
  editorIns: Editor;
22
- }) => void) | undefined;
23
- }>, {
21
+ }) => void;
22
+ };
23
+ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
24
24
  value: string;
25
25
  disabled: boolean;
26
26
  extParameters: () => {};
27
27
  options: () => {};
28
- }>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {
29
- input: (value: string) => void;
30
- }, string, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
31
- /** vue2 v-model */
32
- value?: string | undefined;
33
- /** 是否禁止编辑 */
34
- disabled?: boolean | undefined;
35
- /** 额外参数 */
36
- extParameters?: Record<string, any> | undefined;
37
- /** 富文本编辑器选项 */
38
- options?: Partial<RawEditorOptions> | undefined;
39
- /** 图片上传选项 */
40
- imageUploadOptions?: ImageUploadOptions | undefined;
41
- /** 音频上传组件选项 */
42
- audioUploadOptions?: AudioUploadOptions | undefined;
43
- /** 视频上传选项 */
44
- videoUploadOptions?: VideoUploadOptions | undefined;
45
- /** 初始化完成 */
46
- initComplete?: ((params: {
47
- editorIns: Editor;
48
- }) => void) | undefined;
49
- }>, {
28
+ }>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {}, string, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
50
29
  value: string;
51
30
  disabled: boolean;
52
31
  extParameters: () => {};
53
32
  options: () => {};
54
33
  }>>>, {
34
+ options: Partial<RawEditorOptions>;
55
35
  value: string;
56
36
  disabled: boolean;
57
37
  extParameters: Record<string, any>;
58
- options: Partial<RawEditorOptions>;
59
38
  }>;
60
39
  export default _default;
40
+ type __VLS_WithDefaults<P, D> = {
41
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
42
+ default: D[K];
43
+ }> : P[K];
44
+ };
61
45
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
62
- type __VLS_TypePropsToRuntimeProps<T> = {
46
+ type __VLS_TypePropsToOption<T> = {
63
47
  [K in keyof T]-?: {} extends Pick<T, K> ? {
64
48
  type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
65
49
  } : {
@@ -67,11 +51,6 @@ type __VLS_TypePropsToRuntimeProps<T> = {
67
51
  required: true;
68
52
  };
69
53
  };
70
- type __VLS_WithDefaults<P, D> = {
71
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
72
- default: D[K];
73
- }> : P[K];
74
- };
75
- type __VLS_Prettify<T> = {
54
+ type __VLS_PrettifyLocal<T> = {
76
55
  [K in keyof T]: T[K];
77
56
  } & {};
package/es/editor.vue.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import A from "./editor.vue2.js";
2
2
  import I from "./_virtual/_plugin-vue2_normalizer.js";
3
3
  var h = function() {
4
- var i, l, s, u, d, r, p, n, m, c, g, f, C, v, F, U, _, D, E, b, y;
4
+ var i, l, s, d, u, r, p, n, m, c, g, f, C, v, F, U, _, D, E, b, y;
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.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) {
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((u = (d = e.mergeImageUploadOptions) == null ? void 0 : d.checkOptions) == null ? void 0 : u.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);
12
- }, expression: "uploadAudio.formData.cover" } }, "kb-pro-vue2-image-upload", e.mergeImageUploadOptions, !1))], 1), o("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [o("el-upload", { class: ["upload", { "upload-hide": e.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": e.uploadAudio.formData.file, action: ((F = e.mergeAudioUploadOptions) == null ? void 0 : F.action) || "", data: e.getUploadAudioData(), accept: e.mergeAudioUploadOptions.accept, "list-type": "headTextContent", "before-upload": e.onUploadAudioBeforeUpload, headers: e.getUploadAudioHeaders(), "on-remove": e.onUploadAudioRemove, "on-success": e.onUploadAudioSuccess, "on-error": e.onUploadAudioError, limit: 1 } }, [o("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), o("i", { staticClass: "el-icon-upload el-icon--right" })]), o("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [o("div", { staticClass: "tips" }, [o("p", [a._v("注意:")]), o("div", [o("span", [a._v("1. 仅支持" + a._s((_ = (U = e.mergeAudioUploadOptions) == null ? void 0 : U.allowedType) == null ? void 0 : _.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("2. 单个音频大小不可超过" + a._s((D = e.mergeAudioUploadOptions) == null ? void 0 : D.maxSize) + "M")])])])])], 1)], 1)], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadAudioClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadAudioConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-video-dialog", attrs: { visible: e.uploadVideo.dialogVisible, title: "插入视频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: e.onUploadVideoClose } }, [o("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: e.uploadVideo.formData, "label-width": "auto" } }, [o("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [o("el-upload", { class: ["upload", { "upload-hide": e.uploadVideo.formData.file.length >= 1 }], attrs: { name: "file", "file-list": e.uploadVideo.formData.file, action: e.mergeVideoUploadOptions.action || "", data: e.getUploadVideoData(), accept: e.mergeVideoUploadOptions.accept, "list-type": "headTextContent", "before-upload": e.onUploadVideoBeforeUpload, headers: e.getUploadVideoHeaders(), "on-remove": e.onUploadVideoRemove, "on-success": e.onUploadVideoSuccess, "on-error": e.onUploadVideoError, limit: 1 } }, [o("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), o("i", { staticClass: "el-icon-upload el-icon--right" })]), o("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [o("div", { staticClass: "tips" }, [o("p", [a._v("注意:")]), o("div", [o("span", [a._v("1. 仅支持" + a._s((b = (E = e.mergeVideoUploadOptions) == null ? void 0 : E.allowedType) == null ? void 0 : b.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("2. 单个视频大小不可超过" + a._s((y = e.mergeVideoUploadOptions) == null ? void 0 : y.maxSize) + "M")])])])])], 1)], 1)], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadVideoClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadVideoConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-loading-dialog", attrs: { fullscreen: "", "append-to-body": "", visible: e.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" } }, "kb-pro-vue2-image-upload", e.mergeImageUploadOptions, !1))], 1), o("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [o("el-upload", { class: ["upload", { "upload-hide": e.uploadAudio.formData.file.length >= 1 }], attrs: { name: e.mergeAudioUploadOptions.name, "file-list": e.uploadAudio.formData.file, action: ((F = e.mergeAudioUploadOptions) == null ? void 0 : F.action) || "", data: e.getUploadAudioData(), accept: e.mergeAudioUploadOptions.accept, "list-type": "headTextContent", "before-upload": e.onUploadAudioBeforeUpload, headers: e.getUploadAudioHeaders(), "on-remove": e.onUploadAudioRemove, "on-success": e.onUploadAudioSuccess, "on-error": e.onUploadAudioError, limit: 1 } }, [o("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), o("i", { staticClass: "el-icon-upload el-icon--right" })]), o("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [o("div", { staticClass: "tips" }, [o("p", [a._v("注意:")]), o("div", [o("span", [a._v("1. 仅支持" + a._s((_ = (U = e.mergeAudioUploadOptions) == null ? void 0 : U.allowedType) == null ? void 0 : _.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("2. 单个音频大小不可超过" + a._s((D = e.mergeAudioUploadOptions) == null ? void 0 : D.maxSize) + "M")])])])])], 1)], 1)], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadAudioClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadAudioConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-video-dialog", attrs: { visible: e.uploadVideo.dialogVisible, title: "插入视频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: e.onUploadVideoClose } }, [o("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: e.uploadVideo.formData, "label-width": "auto" } }, [o("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [o("el-upload", { class: ["upload", { "upload-hide": e.uploadVideo.formData.file.length >= 1 }], attrs: { name: e.mergeVideoUploadOptions.name, "file-list": e.uploadVideo.formData.file, action: e.mergeVideoUploadOptions.action || "", data: e.getUploadVideoData(), accept: e.mergeVideoUploadOptions.accept, "list-type": "headTextContent", "before-upload": e.onUploadVideoBeforeUpload, headers: e.getUploadVideoHeaders(), "on-remove": e.onUploadVideoRemove, "on-success": e.onUploadVideoSuccess, "on-error": e.onUploadVideoError, limit: 1 } }, [o("el-button", { attrs: { size: "small", type: "primary" } }, [a._v("上传文件"), o("i", { staticClass: "el-icon-upload el-icon--right" })]), o("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [o("div", { staticClass: "tips" }, [o("p", [a._v("注意:")]), o("div", [o("span", [a._v("1. 仅支持" + a._s((b = (E = e.mergeVideoUploadOptions) == null ? void 0 : E.allowedType) == null ? void 0 : b.map((t) => t.toUpperCase()).join("、")) + "格式")]), o("span", [a._v("2. 单个视频大小不可超过" + a._s((y = e.mergeVideoUploadOptions) == null ? void 0 : y.maxSize) + "M")])])])])], 1)], 1)], 1), o("div", { attrs: { slot: "footer" }, slot: "footer" }, [o("el-button", { on: { click: e.onUploadVideoClose } }, [a._v("取消")]), o("el-button", { attrs: { type: "primary" }, on: { click: e.onUploadVideoConfirm } }, [a._v("确定")])], 1)], 1), o("el-dialog", { staticClass: "tinymce-editor-loading-dialog", attrs: { fullscreen: "", "append-to-body": "", visible: e.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(e.uploadLoadingConfig, "show", t);
14
14
  } } }, [o("div", { staticClass: "tinymce-editor-loading-dialog-content" }, [o("div", { staticClass: "tinymce-editor-spinner" }, [o("div", { staticClass: "tinymce-editor-spinner-dot1" }), o("div", { staticClass: "tinymce-editor-spinner-dot2" }), o("div", { staticClass: "tinymce-editor-spinner-dot3" })]), o("span", [a._v(a._s(e.uploadLoadingConfig.text))])])])], 1);
15
- }, O = [], k = /* @__PURE__ */ I(
15
+ }, O = [], V = /* @__PURE__ */ I(
16
16
  A,
17
17
  h,
18
18
  O
19
19
  );
20
- const w = k.exports;
20
+ const w = V.exports;
21
21
  export {
22
22
  w as default
23
23
  };
package/es/editor.vue2.js CHANGED
@@ -1,37 +1,37 @@
1
1
  var Be = Object.defineProperty, Ve = Object.defineProperties;
2
2
  var je = Object.getOwnPropertyDescriptors;
3
3
  var ue = Object.getOwnPropertySymbols;
4
- var He = Object.prototype.hasOwnProperty, $e = Object.prototype.propertyIsEnumerable;
5
- var ce = (u, n) => (n = Symbol[u]) ? n : Symbol.for("Symbol." + u);
6
- var me = (u, n, i) => n in u ? Be(u, n, { enumerable: !0, configurable: !0, writable: !0, value: i }) : u[n] = i, D = (u, n) => {
7
- for (var i in n || (n = {}))
8
- He.call(n, i) && me(u, i, n[i]);
4
+ var Re = Object.prototype.hasOwnProperty, He = Object.prototype.propertyIsEnumerable;
5
+ var ce = (c, s) => (s = Symbol[c]) ? s : Symbol.for("Symbol." + c);
6
+ var me = (c, s, i) => s in c ? Be(c, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : c[s] = i, D = (c, s) => {
7
+ for (var i in s || (s = {}))
8
+ Re.call(s, i) && me(c, i, s[i]);
9
9
  if (ue)
10
- for (var i of ue(n))
11
- $e.call(n, i) && me(u, i, n[i]);
12
- return u;
13
- }, B = (u, n) => Ve(u, je(n));
14
- var L = (u, n, i) => new Promise((O, T) => {
10
+ for (var i of ue(s))
11
+ He.call(s, i) && me(c, i, s[i]);
12
+ return c;
13
+ }, B = (c, s) => Ve(c, je(s));
14
+ var F = (c, s, i) => new Promise((O, T) => {
15
15
  var P = (g) => {
16
16
  try {
17
- c(i.next(g));
17
+ m(i.next(g));
18
18
  } catch (I) {
19
19
  T(I);
20
20
  }
21
21
  }, V = (g) => {
22
22
  try {
23
- c(i.throw(g));
23
+ m(i.throw(g));
24
24
  } catch (I) {
25
25
  T(I);
26
26
  }
27
- }, c = (g) => g.done ? O(g.value) : Promise.resolve(g.value).then(P, V);
28
- c((i = i.apply(u, n)).next());
27
+ }, m = (g) => g.done ? O(g.value) : Promise.resolve(g.value).then(P, V);
28
+ m((i = i.apply(c, s)).next());
29
29
  });
30
- var G = (u, n, i) => (n = u[ce("asyncIterator")]) ? n.call(u) : (u = u[ce("iterator")](), n = {}, i = (O, T) => (T = u[O]) && (n[O] = (P) => new Promise((V, c, g) => (P = T.call(u, P), g = P.done, Promise.resolve(P.value).then((I) => V({ value: I, done: g }), c)))), i("next"), i("return"), n);
31
- import { defineComponent as Ee, ref as A, computed as X, onMounted as Re, onUnmounted as qe, watch as de } from "vue";
30
+ var G = (c, s, i) => (s = c[ce("asyncIterator")]) ? s.call(c) : (c = c[ce("iterator")](), s = {}, i = (O, T) => (T = c[O]) && (s[O] = (P) => new Promise((V, m, g) => (P = T.call(c, P), g = P.done, Promise.resolve(P.value).then((I) => V({ value: I, done: g }), m)))), i("next"), i("return"), s);
31
+ import { defineComponent as $e, ref as A, computed as X, onMounted as Ee, onUnmounted as qe, watch as de } from "vue";
32
32
  import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We, blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "@keyblade/one-travel";
33
- import "./style.less.js";
34
- import { conclude as F } from "vue-global-config";
33
+ /* empty css */
34
+ import { conclude as W } from "vue-global-config";
35
35
  import pe from "tinymce";
36
36
  import Xe from "./langs/zh_CN.js";
37
37
  import "tinymce/skins/ui/oxide/skin";
@@ -64,10 +64,10 @@ import "tinymce/plugins/table";
64
64
  import "tinymce/plugins/visualblocks";
65
65
  import "tinymce/plugins/visualchars";
66
66
  import "tinymce/plugins/wordcount";
67
- import { globalProps as W } from "./index.js";
67
+ import { globalProps as N } from "./index.js";
68
68
  import { Message as b } from "element-ui";
69
69
  import { defaultImageUploadOptions as S, EImageUploadInnerBeforeUploadStep as Je } from "@keyblade/pro-components-vue2";
70
- const Ha = /* @__PURE__ */ Ee({
70
+ const Ra = /* @__PURE__ */ $e({
71
71
  __name: "editor",
72
72
  props: {
73
73
  value: { default: "" },
@@ -80,8 +80,8 @@ const Ha = /* @__PURE__ */ Ee({
80
80
  initComplete: null
81
81
  },
82
82
  emits: ["input"],
83
- setup(u, { emit: n }) {
84
- const i = u;
83
+ setup(c, { emit: s }) {
84
+ const i = c;
85
85
  pe.addI18n("zh_CN", Xe);
86
86
  const O = {
87
87
  name: S.name,
@@ -94,33 +94,35 @@ const Ha = /* @__PURE__ */ Ee({
94
94
  compressorOptions: S.compressorOptions,
95
95
  cropOptions: S.cropOptions
96
96
  }, T = {
97
+ name: "file",
97
98
  enable: !0,
98
99
  maxSize: 300,
99
100
  allowedType: ["avi", "wmv", "mp4", "mov", "3gp"],
100
101
  accept: ".avi,.wmv,.mp4,.mov,.3gp"
101
102
  }, P = {
103
+ name: "file",
102
104
  enable: !0,
103
105
  maxSize: 200,
104
106
  allowedType: ["wav", "mp3", "mp4", "m4a", "wma", "aac"],
105
107
  accept: ".wav,.mp3,.mp4,.m4a,.wma,.aac"
106
- }, V = A(), c = A(), g = A(!1), I = A(!1), $ = A({
108
+ }, V = A(), m = A(), g = A(!1), I = A(!1), H = A({
107
109
  show: !1,
108
110
  text: "图片上传中,请稍等"
109
- }), p = X(() => F([i.imageUploadOptions, W.imageUploadOptions, O]) || {}), s = X(() => F([i.videoUploadOptions, W.videoUploadOptions, T]) || {}), v = X(() => F([i.audioUploadOptions, W.audioUploadOptions, P]) || {}), E = A({
111
+ }), p = X(() => W([i.imageUploadOptions, N.imageUploadOptions, O]) || {}), u = X(() => W([i.videoUploadOptions, N.videoUploadOptions, T]) || {}), v = X(() => W([i.audioUploadOptions, N.audioUploadOptions, P]) || {}), $ = A({
110
112
  dialogVisible: !1,
111
113
  formData: {
112
114
  images: []
113
115
  }
114
116
  }), j = A(), J = A(), K = () => {
115
- E.value.dialogVisible = !1, E.value.formData = {
117
+ $.value.dialogVisible = !1, $.value.formData = {
116
118
  images: []
117
119
  }, j.value = void 0;
118
120
  }, fe = () => {
119
121
  var o;
120
122
  (o = J.value) == null || o.validate((e) => {
121
- e && (E.value.formData.images.forEach((a) => {
122
- var t;
123
- (t = c.value) == null || t.insertContent(`<img src=${a == null ? void 0 : a.url} alt="" />`);
123
+ e && ($.value.formData.images.forEach((a) => {
124
+ var l;
125
+ (l = m.value) == null || l.insertContent(`<img src=${a == null ? void 0 : a.url} alt="" />`);
124
126
  }), K());
125
127
  });
126
128
  }, w = A({
@@ -144,8 +146,8 @@ const Ha = /* @__PURE__ */ Ee({
144
146
  }, ve = () => {
145
147
  var o;
146
148
  (o = Q.value) == null || o.validate((e) => {
147
- var a, t;
148
- e && ((t = c.value) == null || t.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${w.value.formData.name}" data-poster="${w.value.formData.cover[0]}" src="${(a = w.value.formData.file[0]) == null ? void 0 : a.url}"></audio>`), Y());
149
+ var a, l;
150
+ e && ((l = m.value) == null || l.insertContent(`<audio controls controlslist="nodownload noplaybackrate" data-name="${w.value.formData.name}" data-poster="${w.value.formData.cover[0]}" src="${(a = w.value.formData.file[0]) == null ? void 0 : a.url}"></audio>`), Y());
149
151
  });
150
152
  }, _ = A({
151
153
  dialogVisible: !1,
@@ -162,15 +164,15 @@ const Ha = /* @__PURE__ */ Ee({
162
164
  }, ge = () => {
163
165
  var o;
164
166
  (o = Z.value) == null || o.validate((e) => {
165
- var a, t;
166
- e && ((t = c.value) == null || t.insertContent(`<video width="auto" height="auto" controls src="${(a = _.value.formData.file[0]) == null ? void 0 : a.url}"></video>`), ee());
167
+ var a, l;
168
+ e && ((l = m.value) == null || l.insertContent(`<video width="auto" height="auto" controls src="${(a = _.value.formData.file[0]) == null ? void 0 : a.url}"></video>`), ee());
167
169
  });
168
170
  };
169
171
  function ae(o) {
170
- return L(this, null, function* () {
171
- var m, d, y, f, C, h, U, M, R;
172
+ return F(this, null, function* () {
173
+ var r, d, y, f, C, h, U, M, E;
172
174
  let e = o;
173
- if (!((m = p.value) != null && m.handleRequest)) {
175
+ if (!((r = p.value) != null && r.handleRequest)) {
174
176
  b.error("缺少图片上传配置");
175
177
  return;
176
178
  }
@@ -179,7 +181,7 @@ const Ha = /* @__PURE__ */ Ee({
179
181
  b.error("不允许粘贴");
180
182
  return;
181
183
  }
182
- const t = yield Fe(e, a, {
184
+ const l = yield Fe(e, a, {
183
185
  imageMaxSize: (d = p.value.checkOptions) == null ? void 0 : d.maxSize,
184
186
  imageAllowedType: (y = p.value.checkOptions) == null ? void 0 : y.allowedType,
185
187
  // imageAllowedMineType: mergeImageUploadOptions.value.allowedMineType,
@@ -188,87 +190,86 @@ const Ha = /* @__PURE__ */ Ee({
188
190
  imageMaxWidth: (h = p.value.checkOptions) == null ? void 0 : h.maxWidth,
189
191
  imageMaxHeight: (U = p.value.checkOptions) == null ? void 0 : U.maxHeight
190
192
  });
191
- if (!t.success) {
192
- b.error((t == null ? void 0 : t.errorMessage) || "");
193
+ if (!l.success) {
194
+ b.error((l == null ? void 0 : l.errorMessage) || "");
193
195
  return;
194
196
  }
195
- if (t.hasTransform) {
196
- e = t.file;
197
+ if (l.hasTransform) {
198
+ e = l.file;
197
199
  const ie = a == null ? void 0 : a.split(".");
198
200
  ie.pop(), a = `${ie.join(",")}.jpg`;
199
201
  }
200
- const r = yield We(e);
201
- if (!r.success) {
202
- b.error((r == null ? void 0 : r.errorMessage) || "压缩失败");
202
+ const n = yield We(e);
203
+ if (!n.success) {
204
+ b.error((n == null ? void 0 : n.errorMessage) || "压缩失败");
203
205
  return;
204
206
  }
205
- const l = yield (R = (M = p.value).handleRequest) == null ? void 0 : R.call(M, Ne(r.file, a), a, { extParameters: i.extParameters });
206
- if (!l || !l.success) {
207
- b.error((l == null ? void 0 : l.errorMessage) || "");
207
+ const t = yield (E = (M = p.value).handleRequest) == null ? void 0 : E.call(M, Ne(n.file, a), a, { extParameters: i.extParameters });
208
+ if (!t || !t.success) {
209
+ b.error((t == null ? void 0 : t.errorMessage) || "");
208
210
  return;
209
211
  }
210
- return l.url;
212
+ return t.url;
211
213
  });
212
214
  }
213
- const N = (o) => L(this, null, function* () {
214
- var l, m, d, y, f, C, h, U, M, R, le, ne, re;
215
- const e = c.value, a = o.types;
215
+ const L = (o) => F(this, null, function* () {
216
+ var t, r, d, y, f, C, h, U, M, E, le, ne, re;
217
+ const e = m.value, a = o.types;
216
218
  if (a.includes("text/html")) {
217
- const z = o.getData("text/html"), H = new DOMParser().parseFromString(z, "text/html"), se = Array.from(H.body.querySelectorAll("img")), Te = Array.from(H.body.querySelectorAll("audio")), ze = Array.from(H.body.querySelectorAll("video"));
218
- se.length > 0 && ($.value = {
219
+ const z = o.getData("text/html"), R = new DOMParser().parseFromString(z, "text/html"), se = Array.from(R.body.querySelectorAll("img")), Te = Array.from(R.body.querySelectorAll("audio")), ze = Array.from(R.body.querySelectorAll("video"));
220
+ se.length > 0 && (H.value = {
219
221
  show: !0,
220
222
  text: "图片加载中,请稍等"
221
223
  });
222
224
  for (const k of [...Te, ...ze])
223
225
  k == null || k.remove();
224
226
  try {
225
- for (var ie = G([...se]), Ke, Ra, qa; Ke = !(Ra = yield ie.next()).done; Ke = !1) {
226
- const k = Ra.value;
227
+ for (var ie = G([...se]), Ke, Ea, qa; Ke = !(Ea = yield ie.next()).done; Ke = !1) {
228
+ const k = Ea.value;
227
229
  if (k.removeAttribute("crossorigin"), k.src.startsWith("http"))
228
- if ((l = p.value) != null && l.handleRequestByUrl) {
229
- const x = yield (m = p.value) == null ? void 0 : m.handleRequestByUrl(k.src, { extParameters: i.extParameters });
230
+ if ((t = p.value) != null && t.handleRequestByUrl) {
231
+ const x = yield (r = p.value) == null ? void 0 : r.handleRequestByUrl(k.src, { extParameters: i.extParameters });
230
232
  x != null && x.success && (x != null && x.url) ? k.src = x == null ? void 0 : x.url : k.remove();
231
233
  } else {
232
234
  const x = yield Le(k.src);
233
- x && (x.width < (((y = (d = p.value) == null ? void 0 : d.checkOptions) == null ? void 0 : y.minWidth) || 0) && x.height < (((C = (f = p.value) == null ? void 0 : f.checkOptions) == null ? void 0 : C.minHeight) || 0) || x.width > (((U = (h = p.value) == null ? void 0 : h.checkOptions) == null ? void 0 : U.maxWidth) || 0) && x.height > (((R = (M = p.value) == null ? void 0 : M.checkOptions) == null ? void 0 : R.maxHeight) || 0)) && k.remove();
235
+ x && (x.width < (((y = (d = p.value) == null ? void 0 : d.checkOptions) == null ? void 0 : y.minWidth) || 0) && x.height < (((C = (f = p.value) == null ? void 0 : f.checkOptions) == null ? void 0 : C.minHeight) || 0) || x.width > (((U = (h = p.value) == null ? void 0 : h.checkOptions) == null ? void 0 : U.maxWidth) || 0) && x.height > (((E = (M = p.value) == null ? void 0 : M.checkOptions) == null ? void 0 : E.maxHeight) || 0)) && k.remove();
234
236
  }
235
237
  else
236
238
  k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
237
239
  }
238
- } catch (Ra) {
239
- qa = [Ra];
240
+ } catch (Ea) {
241
+ qa = [Ea];
240
242
  } finally {
241
243
  try {
242
- Ke && (Ra = ie.return) && (yield Ra.call(ie));
244
+ Ke && (Ea = ie.return) && (yield Ea.call(ie));
243
245
  } finally {
244
246
  if (qa)
245
247
  throw qa[0];
246
248
  }
247
249
  }
248
- $.value.show = !1;
249
- const Oe = new XMLSerializer().serializeToString(H.body);
250
+ H.value.show = !1;
251
+ const Oe = new XMLSerializer().serializeToString(R.body);
250
252
  e.insertContent(Oe);
251
- } else
252
- a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
253
- const t = Array.from((o == null ? void 0 : o.files) || []), r = [];
254
- for (const z of t) {
253
+ } else a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
254
+ const l = Array.from((o == null ? void 0 : o.files) || []), n = [];
255
+ for (const z of l) {
255
256
  if (!z)
256
257
  continue;
257
258
  const q = Ge(z.name);
258
- z.type.indexOf("image") > -1 || (re = (ne = (le = p.value) == null ? void 0 : le.checkOptions) == null ? void 0 : ne.allowedType) != null && re.includes(q.toLowerCase()) ? r.push(z) : b.error("暂不支持的文件类型");
259
+ z.type.indexOf("image") > -1 || (re = (ne = (le = p.value) == null ? void 0 : le.checkOptions) == null ? void 0 : ne.allowedType) != null && re.includes(q.toLowerCase()) ? n.push(z) : b.error("暂不支持的文件类型");
259
260
  }
260
- if (r.length > 0) {
261
- $.value = {
261
+ if (n.length > 0) {
262
+ H.value = {
262
263
  show: !0,
263
264
  text: "图片上传中,请稍等"
264
265
  };
265
266
  try {
266
- for (var Fa = G(r), Wa, Na, La; Wa = !(Na = yield Fa.next()).done; Wa = !1) {
267
+ for (var Fa = G(n), Wa, Na, La; Wa = !(Na = yield Fa.next()).done; Wa = !1) {
267
268
  const z = Na.value;
268
269
  const q = yield ae(z);
269
270
  if (q) {
270
- const H = `<img src="${q}" alt="" />`;
271
- e.insertContent(H);
271
+ const R = `<img src="${q}" alt="" />`;
272
+ e.insertContent(R);
272
273
  }
273
274
  }
274
275
  } catch (Na) {
@@ -281,22 +282,22 @@ const Ha = /* @__PURE__ */ Ee({
281
282
  throw La[0];
282
283
  }
283
284
  }
284
- $.value.show = !1;
285
+ H.value.show = !1;
285
286
  }
286
- n("input", e.getContent());
287
+ s("input", e.getContent());
287
288
  }), oe = (o) => {
288
289
  var a;
289
290
  o.preventDefault();
290
291
  const e = o.clipboardData || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.clipboardData);
291
- N(e);
292
+ L(e);
292
293
  }, te = (o) => {
293
294
  var a;
294
295
  o.preventDefault();
295
296
  const e = o.dataTransfer || ((a = o == null ? void 0 : o.originalEvent) == null ? void 0 : a.dataTransfer);
296
- N(e);
297
+ L(e);
297
298
  };
298
- Re(() => {
299
- var a, t, r;
299
+ Ee(() => {
300
+ var a, l, n;
300
301
  const o = {
301
302
  // 设置语言
302
303
  language: "zh_CN",
@@ -379,85 +380,85 @@ const Ha = /* @__PURE__ */ Ee({
379
380
  convert_urls: !1,
380
381
  paste_webkit_styles: "all",
381
382
  paste_data_images: !1,
382
- images_file_types: ((r = (t = (a = p.value) == null ? void 0 : a.checkOptions) == null ? void 0 : t.allowedType) == null ? void 0 : r.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
383
+ images_file_types: ((n = (l = (a = p.value) == null ? void 0 : a.checkOptions) == null ? void 0 : l.allowedType) == null ? void 0 : n.join(",")) || "jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp",
383
384
  // 粘贴前处理
384
- paste_preprocess(l, m) {
385
- m == null || m.preventDefault();
385
+ paste_preprocess(t, r) {
386
+ r == null || r.preventDefault();
386
387
  },
387
- setup(l) {
388
+ setup(t) {
388
389
  var d, y;
389
- const m = () => {
390
- E.value.dialogVisible = !0;
390
+ const r = () => {
391
+ $.value.dialogVisible = !0;
391
392
  };
392
- if (l.ui.registry.addMenuItem("localImage", {
393
+ if (t.ui.registry.addMenuItem("localImage", {
393
394
  text: "图片",
394
395
  icon: "image",
395
- onAction: () => m()
396
- }), l.ui.registry.addButton("localImage", {
396
+ onAction: () => r()
397
+ }), t.ui.registry.addButton("localImage", {
397
398
  icon: "image",
398
399
  tooltip: "图片",
399
- onAction: () => m()
400
+ onAction: () => r()
400
401
  }), (d = v == null ? void 0 : v.value) != null && d.enable) {
401
402
  const f = () => {
402
403
  w.value.dialogVisible = !0;
403
404
  };
404
- l.ui.registry.addMenuItem("localAudio", {
405
+ t.ui.registry.addMenuItem("localAudio", {
405
406
  text: "音频",
406
407
  icon: "arrow-right",
407
408
  onAction: () => f()
408
- }), l.ui.registry.addButton("localAudio", {
409
+ }), t.ui.registry.addButton("localAudio", {
409
410
  icon: "arrow-right",
410
411
  tooltip: "音频",
411
412
  onAction: () => f()
412
413
  });
413
414
  }
414
- if ((y = s == null ? void 0 : s.value) != null && y.enable) {
415
+ if ((y = u == null ? void 0 : u.value) != null && y.enable) {
415
416
  const f = () => {
416
417
  _.value.dialogVisible = !0;
417
418
  };
418
- l.ui.registry.addMenuItem("localVideo", {
419
+ t.ui.registry.addMenuItem("localVideo", {
419
420
  text: "视频",
420
421
  icon: "embed",
421
422
  onAction: () => f()
422
- }), l.ui.registry.addButton("localVideo", {
423
+ }), t.ui.registry.addButton("localVideo", {
423
424
  icon: "embed",
424
425
  tooltip: "视频",
425
426
  onAction: () => f()
426
427
  });
427
428
  }
428
429
  }
429
- }, e = F(
430
+ }, e = W(
430
431
  [
431
432
  i.options,
432
- W.options,
433
+ N.options,
433
434
  o
434
435
  ],
435
436
  {
436
- mergeFunction: (l, m) => (...d) => {
437
- l(...d), m(...d);
437
+ mergeFunction: (t, r) => (...d) => {
438
+ t(...d), r(...d);
438
439
  },
439
440
  type: Object
440
441
  }
441
442
  );
442
- pe.init(e).then(([l]) => {
443
- var m;
444
- l && (l.customProps = D({}, i), l.on("input", () => {
443
+ pe.init(e).then(([t]) => {
444
+ var r;
445
+ t && (t.customProps = D({}, i), t.on("input", () => {
445
446
  if (I.value) {
446
447
  I.value = !1;
447
448
  return;
448
449
  }
449
- g.value = !0, n("input", l.getContent());
450
- }), l.on("change", () => {
451
- n("input", l.getContent());
452
- }), l.on("paste", (d) => {
450
+ g.value = !0, s("input", t.getContent());
451
+ }), t.on("change", () => {
452
+ s("input", t.getContent());
453
+ }), t.on("paste", (d) => {
453
454
  oe(d);
454
- }), l.on("drop", (d) => {
455
+ }), t.on("drop", (d) => {
455
456
  te(d);
456
- }), (m = i.initComplete) == null || m.call(i, { editorIns: l }), c.value = l);
457
+ }), (r = i.initComplete) == null || r.call(i, { editorIns: t }), m.value = t);
457
458
  });
458
459
  }), qe(() => {
459
- var o, e, a, t;
460
- (o = c.value) == null || o.off("input"), (e = c.value) == null || e.off("paste"), (a = c.value) == null || a.off("drop"), (t = c.value) == null || t.destroy();
460
+ var o, e, a, l;
461
+ (o = m.value) == null || o.off("input"), (e = m.value) == null || e.off("paste"), (a = m.value) == null || a.off("drop"), (l = m.value) == null || l.destroy();
461
462
  });
462
463
  const he = () => {
463
464
  var e, a;
@@ -477,19 +478,20 @@ const Ha = /* @__PURE__ */ Ee({
477
478
  var e, a;
478
479
  const o = D({}, w.value.additionalData || {});
479
480
  return ((a = (e = v.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
480
- }, De = (o, e, a) => {
481
- var r, l;
482
- const t = (l = (r = v == null ? void 0 : v.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, o);
483
- t != null && t.url ? a[a.length - 1].url = t.url : t != null && t.errorMessage && (b.error(t.errorMessage), a.splice(a.length - 1, 1)), w.value.formData.file = a;
484
- }, _e = (o, e) => new Promise((a, t) => {
485
- var l, m, d, y, f, C, h, U;
486
- const r = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
487
- if (!((m = (l = v.value) == null ? void 0 : l.allowedType) != null && m.includes(r.toLowerCase()))) {
488
- b.error(`请上传格式为${(y = (d = v.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的音频`), t();
481
+ }, De = (o, e, a) => F(this, null, function* () {
482
+ var t, r;
483
+ const l = (r = (t = v == null ? void 0 : v.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : r.call(t, o);
484
+ let n;
485
+ l instanceof Promise ? yield l : n = l, n != null && n.url ? a[a.length - 1].url = n.url : n != null && n.errorMessage && (b.error(n.errorMessage), a.splice(a.length - 1, 1)), w.value.formData.file = a;
486
+ }), _e = (o, e) => new Promise((a, l) => {
487
+ var t, r, d, y, f, C, h, U;
488
+ const n = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
489
+ if (!((r = (t = v.value) == null ? void 0 : t.allowedType) != null && r.includes(n.toLowerCase()))) {
490
+ b.error(`请上传格式为${(y = (d = v.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的音频`), l();
489
491
  return;
490
492
  }
491
493
  if (o.size > (((f = v.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
492
- b.error(`请上传${((C = v.value) == null ? void 0 : C.maxSize) || 0}M内的音频`), t();
494
+ b.error(`请上传${((C = v.value) == null ? void 0 : C.maxSize) || 0}M内的音频`), l();
493
495
  return;
494
496
  }
495
497
  w.value.additionalData = { file: o }, (U = (h = v == null ? void 0 : v.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
@@ -500,49 +502,50 @@ const Ha = /* @__PURE__ */ Ee({
500
502
  }, Ce = () => {
501
503
  var e, a;
502
504
  const o = D({}, _.value.additionalData || {});
503
- return ((a = (e = s.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
505
+ return ((a = (e = u.value) == null ? void 0 : e.data) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
504
506
  }, Ue = () => {
505
507
  var e, a;
506
508
  const o = D({}, _.value.additionalData || {});
507
- return ((a = (e = s.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
508
- }, Ie = (o, e, a) => {
509
- var r, l;
510
- const t = (l = (r = s == null ? void 0 : s.value) == null ? void 0 : r.handlerResponse) == null ? void 0 : l.call(r, o);
511
- t != null && t.url ? a[a.length - 1].url = t.url : t != null && t.errorMessage && (b.error(t.errorMessage), a.splice(a.length - 1, 1)), _.value.formData.file = a;
512
- }, Pe = (o, e) => new Promise((a, t) => {
513
- var l, m, d, y, f, C, h, U;
514
- const r = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
515
- if (!((m = (l = s == null ? void 0 : s.value) == null ? void 0 : l.allowedType) != null && m.includes(r.toLowerCase()))) {
516
- b.error(`请上传格式为${(y = (d = s == null ? void 0 : s.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的视频`), t();
509
+ return ((a = (e = u.value) == null ? void 0 : e.headers) == null ? void 0 : a.call(e, B(D({}, o), { extParameters: i.extParameters }))) || {};
510
+ }, Ie = (o, e, a) => F(this, null, function* () {
511
+ var t, r;
512
+ const l = (r = (t = u == null ? void 0 : u.value) == null ? void 0 : t.handlerResponse) == null ? void 0 : r.call(t, o);
513
+ let n;
514
+ l instanceof Promise ? yield l : n = l, n != null && n.url ? a[a.length - 1].url = n.url : n != null && n.errorMessage && (b.error(n.errorMessage), a.splice(a.length - 1, 1)), _.value.formData.file = a;
515
+ }), Pe = (o, e) => new Promise((a, l) => {
516
+ var t, r, d, y, f, C, h, U;
517
+ const n = o.name.split(".").filter(Boolean).pop() ? o.name.split(".").filter(Boolean).pop() : "";
518
+ if (!((r = (t = u == null ? void 0 : u.value) == null ? void 0 : t.allowedType) != null && r.includes(n.toLowerCase()))) {
519
+ b.error(`请上传格式为${(y = (d = u == null ? void 0 : u.value) == null ? void 0 : d.allowedType) == null ? void 0 : y.map((M) => M.toUpperCase()).join("、")}的视频`), l();
517
520
  return;
518
521
  }
519
- if (o.size > (((f = s == null ? void 0 : s.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
520
- b.error(`请上传${((C = s == null ? void 0 : s.value) == null ? void 0 : C.maxSize) || 0}M内的视频`), t();
522
+ if (o.size > (((f = u == null ? void 0 : u.value) == null ? void 0 : f.maxSize) || 0) * 1024 * 1024) {
523
+ b.error(`请上传${((C = u == null ? void 0 : u.value) == null ? void 0 : C.maxSize) || 0}M内的视频`), l();
521
524
  return;
522
525
  }
523
- _.value.additionalData = { file: o }, (U = (h = s == null ? void 0 : s.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
526
+ _.value.additionalData = { file: o }, (U = (h = u == null ? void 0 : u.value) == null ? void 0 : h.beforeUploadEnd) == null || U.call(h, o), a(!0);
524
527
  }), Me = (o, e) => {
525
528
  _.value.formData.file = e;
526
529
  }, Se = (o, e, a) => {
527
530
  b.error("上传发生错误,请重试!"), _.value.formData.file = a;
528
531
  };
529
- return de(() => [i.disabled, c.value], () => {
532
+ return de(() => [i.disabled, m.value], () => {
530
533
  var o, e;
531
- (e = (o = c.value) == null ? void 0 : o.mode) == null || e.set(i.disabled ? "readonly" : "design");
534
+ (e = (o = m.value) == null ? void 0 : o.mode) == null || e.set(i.disabled ? "readonly" : "design");
532
535
  }, { immediate: !0 }), de(
533
- () => [i.value, c.value],
536
+ () => [i.value, m.value],
534
537
  () => {
535
- var o, e, a, t;
538
+ var o, e, a, l;
536
539
  if (g.value) {
537
540
  g.value = !1;
538
541
  return;
539
542
  }
540
- I.value = !0, (o = c.value) == null || o.setContent(i.value ? i.value : ""), (a = c.value) == null || a.selection.select((e = c.value) == null ? void 0 : e.getBody(), !0), (t = c.value) == null || t.selection.collapse(!1);
543
+ I.value = !0, (o = m.value) == null || o.setContent(i.value ? i.value : ""), (a = m.value) == null || a.selection.select((e = m.value) == null ? void 0 : e.getBody(), !0), (l = m.value) == null || l.selection.collapse(!1);
541
544
  },
542
545
  { immediate: !0 }
543
- ), { __sfc: !0, defaultImageUploadOptions: O, defaultVideoUploadOptions: T, defaultAudioUploadOptions: P, props: i, emits: n, insRef: V, editorRef: c, preventSettingContent: g, preventUpdatingModelValue: I, uploadLoadingConfig: $, mergeImageUploadOptions: p, mergeVideoUploadOptions: s, mergeAudioUploadOptions: v, uploadImage: E, uploadImageAdditionalData: j, uploadImageFormRef: J, onUploadImageClose: K, onUploadImageConfirm: fe, uploadAudio: w, uploadAudioFormRef: Q, onUploadAudioClose: Y, onUploadAudioConfirm: ve, uploadVideo: _, uploadVideoFormRef: Z, onUploadVideoClose: ee, onUploadVideoConfirm: ge, uploadPasteOrDropFile: ae, handleDataTransfer: N, onValuePaste: oe, onValueDrop: te, getUploadImageData: he, getUploadImageHeaders: xe, onUploadImageInnerBeforeUploadEnd: be, getUploadAudioData: we, getUploadAudioHeaders: ye, onUploadAudioSuccess: De, onUploadAudioBeforeUpload: _e, onUploadAudioRemove: ke, onUploadAudioError: Ae, getUploadVideoData: Ce, getUploadVideoHeaders: Ue, onUploadVideoSuccess: Ie, onUploadVideoBeforeUpload: Pe, onUploadVideoRemove: Me, onUploadVideoError: Se };
546
+ ), { __sfc: !0, defaultImageUploadOptions: O, defaultVideoUploadOptions: T, defaultAudioUploadOptions: P, props: i, emits: s, insRef: V, editorRef: m, preventSettingContent: g, preventUpdatingModelValue: I, uploadLoadingConfig: H, mergeImageUploadOptions: p, mergeVideoUploadOptions: u, mergeAudioUploadOptions: v, uploadImage: $, uploadImageAdditionalData: j, uploadImageFormRef: J, onUploadImageClose: K, onUploadImageConfirm: fe, uploadAudio: w, uploadAudioFormRef: Q, onUploadAudioClose: Y, onUploadAudioConfirm: ve, uploadVideo: _, uploadVideoFormRef: Z, onUploadVideoClose: ee, onUploadVideoConfirm: ge, uploadPasteOrDropFile: ae, handleDataTransfer: L, onValuePaste: oe, onValueDrop: te, getUploadImageData: he, getUploadImageHeaders: xe, onUploadImageInnerBeforeUploadEnd: be, getUploadAudioData: we, getUploadAudioHeaders: ye, onUploadAudioSuccess: De, onUploadAudioBeforeUpload: _e, onUploadAudioRemove: ke, onUploadAudioError: Ae, getUploadVideoData: Ce, getUploadVideoHeaders: Ue, onUploadVideoSuccess: Ie, onUploadVideoBeforeUpload: Pe, onUploadVideoRemove: Me, onUploadVideoError: Se };
544
547
  }
545
548
  });
546
549
  export {
547
- Ha as default
550
+ Ra as default
548
551
  };
package/es/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { RawEditorOptions } from 'tinymce';
2
2
  import { AudioUploadOptions, ImageUploadOptions, VideoUploadOptions } from './types';
3
-
4
3
  interface TinymceEditorGlobalOptions {
5
4
  /** 富文本编辑器选项 */
6
5
  options?: RawEditorOptions;
@@ -13,6 +12,10 @@ interface TinymceEditorGlobalOptions {
13
12
  }
14
13
  declare const globalProps: TinymceEditorGlobalOptions;
15
14
  declare const TinymceEditor: import('vue/types/v3-component-public-instance').ComponentPublicInstanceConstructor<import('vue/types/v3-component-public-instance').Vue3Instance<{}, Readonly<import('vue').ExtractPropTypes<{
15
+ options: {
16
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
17
+ default: () => {};
18
+ };
16
19
  value: {
17
20
  type: import('vue').PropType<string>;
18
21
  default: string;
@@ -25,10 +28,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
25
28
  type: import('vue').PropType<Record<string, any>>;
26
29
  default: () => {};
27
30
  };
28
- options: {
29
- type: import('vue').PropType<Partial<RawEditorOptions>>;
30
- default: () => {};
31
- };
32
31
  imageUploadOptions: {
33
32
  type: import('vue').PropType<ImageUploadOptions>;
34
33
  };
@@ -44,6 +43,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
44
43
  }) => void>;
45
44
  };
46
45
  }>>, Readonly<import('vue').ExtractPropTypes<{
46
+ options: {
47
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
48
+ default: () => {};
49
+ };
47
50
  value: {
48
51
  type: import('vue').PropType<string>;
49
52
  default: string;
@@ -56,10 +59,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
56
59
  type: import('vue').PropType<Record<string, any>>;
57
60
  default: () => {};
58
61
  };
59
- options: {
60
- type: import('vue').PropType<Partial<RawEditorOptions>>;
61
- default: () => {};
62
- };
63
62
  imageUploadOptions: {
64
63
  type: import('vue').PropType<ImageUploadOptions>;
65
64
  };
@@ -74,14 +73,16 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
74
73
  editorIns: import('tinymce').Editor;
75
74
  }) => void>;
76
75
  };
77
- }>>, {
78
- input: (value: string) => void;
79
- }, {
76
+ }>>, {}, {
77
+ options: Partial<RawEditorOptions>;
80
78
  value: string;
81
79
  disabled: boolean;
82
80
  extParameters: Record<string, any>;
83
- options: Partial<RawEditorOptions>;
84
81
  }, true, import('vue/types/v3-component-options').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import('vue').ExtractPropTypes<{
82
+ options: {
83
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
84
+ default: () => {};
85
+ };
85
86
  value: {
86
87
  type: import('vue').PropType<string>;
87
88
  default: string;
@@ -94,10 +95,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
94
95
  type: import('vue').PropType<Record<string, any>>;
95
96
  default: () => {};
96
97
  };
97
- options: {
98
- type: import('vue').PropType<Partial<RawEditorOptions>>;
99
- default: () => {};
100
- };
101
98
  imageUploadOptions: {
102
99
  type: import('vue').PropType<ImageUploadOptions>;
103
100
  };
@@ -113,6 +110,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
113
110
  }) => void>;
114
111
  };
115
112
  }>>> & import('vue').ShallowUnwrapRef<{}> & import('vue/types/v3-component-options').ExtractComputedReturns<{}> & import('vue').ComponentCustomProperties & Readonly<import('vue').ExtractPropTypes<{
113
+ options: {
114
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
115
+ default: () => {};
116
+ };
116
117
  value: {
117
118
  type: import('vue').PropType<string>;
118
119
  default: string;
@@ -125,10 +126,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
125
126
  type: import('vue').PropType<Record<string, any>>;
126
127
  default: () => {};
127
128
  };
128
- options: {
129
- type: import('vue').PropType<Partial<RawEditorOptions>>;
130
- default: () => {};
131
- };
132
129
  imageUploadOptions: {
133
130
  type: import('vue').PropType<ImageUploadOptions>;
134
131
  };
@@ -144,6 +141,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
144
141
  }) => void>;
145
142
  };
146
143
  }>>> & import('vue/types/v3-component-options').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
144
+ options: {
145
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
146
+ default: () => {};
147
+ };
147
148
  value: {
148
149
  type: import('vue').PropType<string>;
149
150
  default: string;
@@ -156,10 +157,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
156
157
  type: import('vue').PropType<Record<string, any>>;
157
158
  default: () => {};
158
159
  };
159
- options: {
160
- type: import('vue').PropType<Partial<RawEditorOptions>>;
161
- default: () => {};
162
- };
163
160
  imageUploadOptions: {
164
161
  type: import('vue').PropType<ImageUploadOptions>;
165
162
  };
@@ -174,15 +171,17 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
174
171
  editorIns: import('tinymce').Editor;
175
172
  }) => void>;
176
173
  };
177
- }>>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {
178
- input: (value: string) => void;
179
- }, string, {
174
+ }>>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {}, string, {
175
+ options: Partial<RawEditorOptions>;
180
176
  value: string;
181
177
  disabled: boolean;
182
178
  extParameters: Record<string, any>;
183
- options: Partial<RawEditorOptions>;
184
179
  }> & {
185
180
  props: {
181
+ options: {
182
+ type: import('vue').PropType<Partial<RawEditorOptions>>;
183
+ default: () => {};
184
+ };
186
185
  value: {
187
186
  type: import('vue').PropType<string>;
188
187
  default: string;
@@ -195,10 +194,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
195
194
  type: import('vue').PropType<Record<string, any>>;
196
195
  default: () => {};
197
196
  };
198
- options: {
199
- type: import('vue').PropType<Partial<RawEditorOptions>>;
200
- default: () => {};
201
- };
202
197
  imageUploadOptions: {
203
198
  type: import('vue').PropType<ImageUploadOptions>;
204
199
  };
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import './style.css';
1
+ import './tinymce-editor-vue2.css';
2
2
  import e from "./editor.vue.js";
3
3
  import { Button as t, Slider as u, Dialog as i, Upload as n, Tag as r, Form as m, FormItem as c, ButtonGroup as l, InputNumber as d, Loading as g } from "element-ui";
4
4
  const b = {}, y = Object.assign(e, {
package/es/types.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/one-travel';
2
-
3
2
  /** 图片选项 */
4
3
  export interface ImageUploadOptions {
5
4
  /** 上传的文件字段名 - 默认: file */
@@ -59,6 +58,8 @@ export interface ImageUploadOptions {
59
58
  }
60
59
  /** 视频选项 */
61
60
  export interface VideoUploadOptions {
61
+ /** 上传的文件字段名 - 默认: file */
62
+ name?: string;
62
63
  /** 是否启用 */
63
64
  enable?: boolean;
64
65
  /** 最大尺寸(M) */
@@ -85,10 +86,15 @@ export interface VideoUploadOptions {
85
86
  handlerResponse?: (response: any) => {
86
87
  url?: string;
87
88
  errorMessage?: string;
88
- };
89
+ } | Promise<{
90
+ url?: string;
91
+ errorMessage?: string;
92
+ }>;
89
93
  }
90
94
  /** 音频选项 */
91
95
  export interface AudioUploadOptions {
96
+ /** 上传的文件字段名 - 默认: file */
97
+ name?: string;
92
98
  /** 是否启用 */
93
99
  enable?: boolean;
94
100
  /** 最大尺寸(M) */
@@ -115,5 +121,8 @@ export interface AudioUploadOptions {
115
121
  handlerResponse?: (response: any) => {
116
122
  url?: string;
117
123
  errorMessage?: string;
118
- };
124
+ } | Promise<{
125
+ url?: string;
126
+ errorMessage?: string;
127
+ }>;
119
128
  }
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.2.0",
5
+ "version": "1.2.2",
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.13.1"
30
+ "@keyblade/pro-components-vue2": "^1.13.2"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "vite build",
package/es/style.less.js DELETED
@@ -1 +0,0 @@
1
-
File without changes