@keyblade/tinymce-editor-vue2 1.0.4 → 1.2.1
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 +2 -61
- package/es/_virtual/_plugin-vue2_normalizer.js +3 -3
- package/es/editor.vue.d.ts +20 -41
- package/es/editor.vue.js +5 -5
- package/es/editor.vue2.js +21 -21
- package/es/index.d.ts +2 -8
- package/es/index.js +9 -14
- package/es/types.d.ts +5 -2
- package/package.json +3 -3
- package/es/style.less.js +0 -1
- package/es/util.d.ts +0 -21
- package/es/util.js +0 -27
- package/src/index.ts +0 -54
- /package/es/{style.css → tinymce-editor-vue2.css} +0 -0
package/README.md
CHANGED
|
@@ -6,21 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
升级指南:https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
|
|
8
8
|
|
|
9
|
-
## 版本区分
|
|
10
|
-
- 0.x.x - 图片使用第三方 imgpond 组件
|
|
11
|
-
- 1.x.x - 图片使用自己封装的 ProVue2ImageUpload 组件
|
|
12
|
-
|
|
13
9
|
## 一、安装
|
|
14
10
|
```shell
|
|
15
11
|
yarn add @keyblade/tinymce-editor-vue2
|
|
16
12
|
# 下面两个是编辑器需要的第三方依赖,如原项目中有,可以不用安装,但要注意版本,必须匹配,否则css样式有问题。
|
|
17
13
|
|
|
18
|
-
#
|
|
19
|
-
yarn add
|
|
20
|
-
yarn add imgpond@0.6.2
|
|
21
|
-
|
|
22
|
-
# 1.x.x版本 需要安装如下:
|
|
23
|
-
yarn add @keyblade/pro-components-vue2@1.12.6
|
|
14
|
+
# 需要安装如下:
|
|
15
|
+
yarn add @keyblade/pro-components-vue2@1.13.1
|
|
24
16
|
```
|
|
25
17
|
|
|
26
18
|
## 二、使用
|
|
@@ -28,28 +20,13 @@ yarn add @keyblade/pro-components-vue2@1.12.6
|
|
|
28
20
|
```typescript
|
|
29
21
|
import TinymceEditor from '@keyblade/tinymce-editor-vue2'
|
|
30
22
|
|
|
31
|
-
// 0.x.x版本
|
|
32
|
-
// 如原项目中,则不需要
|
|
33
|
-
import PicViewer from 'pic-viewer'
|
|
34
|
-
import 'pic-viewer/dist/style.css'
|
|
35
|
-
|
|
36
|
-
// 如原项目中,则不需要(0.x.x版本)
|
|
37
|
-
import ImgPond from 'imgpond'
|
|
38
|
-
import 'imgpond/dist/style.css'
|
|
39
|
-
|
|
40
|
-
Vue.use(PicViewer, {})
|
|
41
|
-
Vue.use(ImgPond, {})
|
|
42
|
-
|
|
43
|
-
// 1.x.x版本
|
|
44
23
|
import { ProVue2ImageUpload } from '@keyblade/pro-components-vue2'
|
|
45
24
|
import '@keyblade/pro-components-vue2/es/style.css'
|
|
46
25
|
Vue.use(ProVue2ImageUpload)
|
|
47
26
|
|
|
48
|
-
|
|
49
27
|
Vue.use(TinymceEditor, {
|
|
50
28
|
// 图片
|
|
51
29
|
imageUploadOptions: {
|
|
52
|
-
/** 1.x.x版本新增 */
|
|
53
30
|
action: '/api/man/uploadFile/uploadSingleFile',
|
|
54
31
|
handlerResponse: (response: any) => {
|
|
55
32
|
return new Promise((resolve) => {
|
|
@@ -67,7 +44,6 @@ Vue.use(TinymceEditor, {
|
|
|
67
44
|
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
68
45
|
return {}
|
|
69
46
|
},
|
|
70
|
-
/** 1.x.x版本新增 */
|
|
71
47
|
|
|
72
48
|
handleRequest: (file: File, filename: string, parameters: { extParameters: Record<string, any> }) => {
|
|
73
49
|
return new Promise((resolve) => {
|
|
@@ -156,9 +132,6 @@ interface TinymceEditorGlobalOptions {
|
|
|
156
132
|
/** 图片上传选项 */
|
|
157
133
|
imageUploadOptions?: ImageUploadOptions;
|
|
158
134
|
|
|
159
|
-
/** imgPond 选项(1.x.x版本废弃) */
|
|
160
|
-
imgPondOptions?: Record<string, any>;
|
|
161
|
-
|
|
162
135
|
/** 音频上传选项 */
|
|
163
136
|
audioUploadOptions?: AudioUploadOptions;
|
|
164
137
|
|
|
@@ -183,9 +156,6 @@ interface ComponentOptions {
|
|
|
183
156
|
/** 图片上传选项 */
|
|
184
157
|
imageUploadOptions?: ImageUploadOptions;
|
|
185
158
|
|
|
186
|
-
/** imgPond选项(1.x.x版本废弃) */
|
|
187
|
-
imgPondOptions?: Record<string, any>;
|
|
188
|
-
|
|
189
159
|
/** 音频上传组件选项 */
|
|
190
160
|
audioUploadOptions?: AudioUploadOptions;
|
|
191
161
|
|
|
@@ -199,7 +169,6 @@ interface ComponentOptions {
|
|
|
199
169
|
|
|
200
170
|
### 3.图片上传配置
|
|
201
171
|
```typescript
|
|
202
|
-
// 1.x.x版本
|
|
203
172
|
export interface ImageUploadOptions {
|
|
204
173
|
/** 上传的文件字段名 - 默认: file */
|
|
205
174
|
name?: string;
|
|
@@ -239,34 +208,6 @@ export interface ImageUploadOptions {
|
|
|
239
208
|
extParameters?: Record<string, any>
|
|
240
209
|
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
241
210
|
}
|
|
242
|
-
|
|
243
|
-
// 0.x.x版本
|
|
244
|
-
export interface ImageUploadOptions {
|
|
245
|
-
/** 图片上传组件最大数量 */
|
|
246
|
-
maxCount?: number;
|
|
247
|
-
/** 图片上传组件下方文字 */
|
|
248
|
-
tipText?: string;
|
|
249
|
-
/** 图片最大值(单位M,主要用于错误提示) */
|
|
250
|
-
maxSize?: number;
|
|
251
|
-
/** 图片允许的后缀类型(小写,如: png、jpg) */
|
|
252
|
-
allowedType?: string[];
|
|
253
|
-
/** 图片最小宽度 */
|
|
254
|
-
minWidth?: number;
|
|
255
|
-
/** 图片最小高度 */
|
|
256
|
-
minHeight?: number;
|
|
257
|
-
/** 图片最大宽度 */
|
|
258
|
-
maxWidth?: number;
|
|
259
|
-
/** 图片最大高度 */
|
|
260
|
-
maxHeight?: number;
|
|
261
|
-
/** 图片上传请求处理 */
|
|
262
|
-
handleRequest?: (file: File, filename: string, options?: {
|
|
263
|
-
extParameters?: Record<string, any>
|
|
264
|
-
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
265
|
-
/** 图片URL上传请求处理(前端跨域,交给后端处理) */
|
|
266
|
-
handleRequestByUrl?: (url: string, options?: {
|
|
267
|
-
extParameters?: Record<string, any>
|
|
268
|
-
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
269
|
-
}
|
|
270
211
|
```
|
|
271
212
|
|
|
272
213
|
### 4.视频上传配置
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function f(e, o, t, d, i, a, l, u) {
|
|
2
2
|
var n = typeof e == "function" ? e.options : e;
|
|
3
|
-
return
|
|
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
|
-
|
|
9
|
+
f as default
|
|
10
10
|
};
|
package/es/editor.vue.d.ts
CHANGED
|
@@ -1,52 +1,31 @@
|
|
|
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
|
|
5
|
+
value?: string;
|
|
7
6
|
/** 是否禁止编辑 */
|
|
8
|
-
disabled?: boolean
|
|
7
|
+
disabled?: boolean;
|
|
9
8
|
/** 额外参数 */
|
|
10
|
-
extParameters?: Record<string, any
|
|
9
|
+
extParameters?: Record<string, any>;
|
|
11
10
|
/** 富文本编辑器选项 */
|
|
12
|
-
options?: Partial<RawEditorOptions
|
|
11
|
+
options?: Partial<RawEditorOptions>;
|
|
13
12
|
/** 图片上传选项 */
|
|
14
|
-
imageUploadOptions?: ImageUploadOptions
|
|
13
|
+
imageUploadOptions?: ImageUploadOptions;
|
|
15
14
|
/** 音频上传组件选项 */
|
|
16
|
-
audioUploadOptions?: AudioUploadOptions
|
|
15
|
+
audioUploadOptions?: AudioUploadOptions;
|
|
17
16
|
/** 视频上传选项 */
|
|
18
|
-
videoUploadOptions?: VideoUploadOptions
|
|
17
|
+
videoUploadOptions?: VideoUploadOptions;
|
|
19
18
|
/** 初始化完成 */
|
|
20
|
-
initComplete?: (
|
|
19
|
+
initComplete?: (params: {
|
|
21
20
|
editorIns: Editor;
|
|
22
|
-
}) => void
|
|
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: () => {};
|
|
@@ -58,8 +37,13 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
58
37
|
extParameters: Record<string, any>;
|
|
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
|
|
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
|
|
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,
|
|
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((
|
|
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:
|
|
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 = [],
|
|
15
|
+
}, O = [], V = /* @__PURE__ */ I(
|
|
16
16
|
A,
|
|
17
17
|
h,
|
|
18
18
|
O
|
|
19
19
|
);
|
|
20
|
-
const w =
|
|
20
|
+
const w = V.exports;
|
|
21
21
|
export {
|
|
22
22
|
w as default
|
|
23
23
|
};
|
package/es/editor.vue2.js
CHANGED
|
@@ -29,9 +29,8 @@ var L = (u, n, i) => new Promise((O, T) => {
|
|
|
29
29
|
});
|
|
30
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
31
|
import { defineComponent as Ee, ref as A, computed as X, onMounted as Re, onUnmounted as qe, watch as de } from "vue";
|
|
32
|
-
import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We } from "@keyblade/one-travel";
|
|
33
|
-
|
|
34
|
-
import "./style.less.js";
|
|
32
|
+
import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We, blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "@keyblade/one-travel";
|
|
33
|
+
/* empty css */
|
|
35
34
|
import { conclude as F } from "vue-global-config";
|
|
36
35
|
import pe from "tinymce";
|
|
37
36
|
import Xe from "./langs/zh_CN.js";
|
|
@@ -68,7 +67,7 @@ import "tinymce/plugins/wordcount";
|
|
|
68
67
|
import { globalProps as W } from "./index.js";
|
|
69
68
|
import { Message as b } from "element-ui";
|
|
70
69
|
import { defaultImageUploadOptions as S, EImageUploadInnerBeforeUploadStep as Je } from "@keyblade/pro-components-vue2";
|
|
71
|
-
const
|
|
70
|
+
const Ha = /* @__PURE__ */ Ee({
|
|
72
71
|
__name: "editor",
|
|
73
72
|
props: {
|
|
74
73
|
value: { default: "" },
|
|
@@ -95,11 +94,13 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
95
94
|
compressorOptions: S.compressorOptions,
|
|
96
95
|
cropOptions: S.cropOptions
|
|
97
96
|
}, T = {
|
|
97
|
+
name: "file",
|
|
98
98
|
enable: !0,
|
|
99
99
|
maxSize: 300,
|
|
100
100
|
allowedType: ["avi", "wmv", "mp4", "mov", "3gp"],
|
|
101
101
|
accept: ".avi,.wmv,.mp4,.mov,.3gp"
|
|
102
102
|
}, P = {
|
|
103
|
+
name: "file",
|
|
103
104
|
enable: !0,
|
|
104
105
|
maxSize: 200,
|
|
105
106
|
allowedType: ["wav", "mp3", "mp4", "m4a", "wma", "aac"],
|
|
@@ -223,8 +224,8 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
223
224
|
for (const k of [...Te, ...ze])
|
|
224
225
|
k == null || k.remove();
|
|
225
226
|
try {
|
|
226
|
-
for (var ie = G([...se]), Ke,
|
|
227
|
-
const k =
|
|
227
|
+
for (var ie = G([...se]), Ke, Ra, qa; Ke = !(Ra = yield ie.next()).done; Ke = !1) {
|
|
228
|
+
const k = Ra.value;
|
|
228
229
|
if (k.removeAttribute("crossorigin"), k.src.startsWith("http"))
|
|
229
230
|
if ((l = p.value) != null && l.handleRequestByUrl) {
|
|
230
231
|
const x = yield (m = p.value) == null ? void 0 : m.handleRequestByUrl(k.src, { extParameters: i.extParameters });
|
|
@@ -236,21 +237,20 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
236
237
|
else
|
|
237
238
|
k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
238
239
|
}
|
|
239
|
-
} catch (
|
|
240
|
-
|
|
240
|
+
} catch (Ra) {
|
|
241
|
+
qa = [Ra];
|
|
241
242
|
} finally {
|
|
242
243
|
try {
|
|
243
|
-
Ke && (
|
|
244
|
+
Ke && (Ra = ie.return) && (yield Ra.call(ie));
|
|
244
245
|
} finally {
|
|
245
|
-
if (
|
|
246
|
-
throw
|
|
246
|
+
if (qa)
|
|
247
|
+
throw qa[0];
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
250
|
$.value.show = !1;
|
|
250
251
|
const Oe = new XMLSerializer().serializeToString(H.body);
|
|
251
252
|
e.insertContent(Oe);
|
|
252
|
-
} else
|
|
253
|
-
a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
|
|
253
|
+
} else a.includes("text/plain") && e.insertContent(o.getData("text/plain"));
|
|
254
254
|
const t = Array.from((o == null ? void 0 : o.files) || []), r = [];
|
|
255
255
|
for (const z of t) {
|
|
256
256
|
if (!z)
|
|
@@ -264,22 +264,22 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
264
264
|
text: "图片上传中,请稍等"
|
|
265
265
|
};
|
|
266
266
|
try {
|
|
267
|
-
for (var
|
|
268
|
-
const z =
|
|
267
|
+
for (var Fa = G(r), Wa, Na, La; Wa = !(Na = yield Fa.next()).done; Wa = !1) {
|
|
268
|
+
const z = Na.value;
|
|
269
269
|
const q = yield ae(z);
|
|
270
270
|
if (q) {
|
|
271
271
|
const H = `<img src="${q}" alt="" />`;
|
|
272
272
|
e.insertContent(H);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
} catch (
|
|
276
|
-
|
|
275
|
+
} catch (Na) {
|
|
276
|
+
La = [Na];
|
|
277
277
|
} finally {
|
|
278
278
|
try {
|
|
279
|
-
|
|
279
|
+
Wa && (Na = Fa.return) && (yield Na.call(Fa));
|
|
280
280
|
} finally {
|
|
281
|
-
if (
|
|
282
|
-
throw
|
|
281
|
+
if (La)
|
|
282
|
+
throw La[0];
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
$.value.show = !1;
|
|
@@ -545,5 +545,5 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
export {
|
|
548
|
-
|
|
548
|
+
Ha as default
|
|
549
549
|
};
|
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;
|
|
@@ -74,9 +73,7 @@ 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
|
+
}>>, {}, {
|
|
80
77
|
options: Partial<RawEditorOptions>;
|
|
81
78
|
value: string;
|
|
82
79
|
disabled: boolean;
|
|
@@ -174,9 +171,7 @@ 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, {
|
|
180
175
|
options: Partial<RawEditorOptions>;
|
|
181
176
|
value: string;
|
|
182
177
|
disabled: boolean;
|
|
@@ -219,5 +214,4 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
219
214
|
};
|
|
220
215
|
export { TinymceEditor, globalProps, type TinymceEditorGlobalOptions };
|
|
221
216
|
export default TinymceEditor;
|
|
222
|
-
export * from './util';
|
|
223
217
|
export type {} from './components';
|
package/es/index.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import './
|
|
2
|
-
import
|
|
3
|
-
import { Button as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.assign(d, t || {}), e.use(s), e.use(i), e.use(n), e.use(r), e.use(u), e.use(m), e.use(l), e.use(g), e.use(c), e.use(b), e.component("KbTinymceEditor", o);
|
|
1
|
+
import './tinymce-editor-vue2.css';
|
|
2
|
+
import e from "./editor.vue.js";
|
|
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
|
+
const b = {}, y = Object.assign(e, {
|
|
5
|
+
install: (o, s) => {
|
|
6
|
+
Object.assign(b, s || {}), o.use(t), o.use(u), o.use(i), o.use(n), o.use(r), o.use(m), o.use(c), o.use(l), o.use(d), o.use(g), o.component("KbTinymceEditor", e);
|
|
8
7
|
}
|
|
9
8
|
});
|
|
10
9
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
y as generateUUID,
|
|
15
|
-
U as getFileExtension,
|
|
16
|
-
a as getImagePixel,
|
|
17
|
-
d as globalProps
|
|
10
|
+
y as TinymceEditor,
|
|
11
|
+
y as default,
|
|
12
|
+
b as globalProps
|
|
18
13
|
};
|
package/es/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/
|
|
2
|
-
|
|
1
|
+
import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/one-travel';
|
|
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) */
|
|
@@ -89,6 +90,8 @@ export interface VideoUploadOptions {
|
|
|
89
90
|
}
|
|
90
91
|
/** 音频选项 */
|
|
91
92
|
export interface AudioUploadOptions {
|
|
93
|
+
/** 上传的文件字段名 - 默认: file */
|
|
94
|
+
name?: string;
|
|
92
95
|
/** 是否启用 */
|
|
93
96
|
enable?: boolean;
|
|
94
97
|
/** 最大尺寸(M) */
|
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.
|
|
5
|
+
"version": "1.2.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "es/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"vue-global-config": "^0.2.6",
|
|
24
24
|
"tinymce": "^7.1.0",
|
|
25
25
|
"element-ui": "^2.15.14",
|
|
26
|
-
"@keyblade/one-travel": "^
|
|
26
|
+
"@keyblade/one-travel": "^3.0.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"vue": "^2.7.0",
|
|
30
|
-
"@keyblade/pro-components-vue2": "^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
|
-
|
package/es/util.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 获取图片像素
|
|
3
|
-
* @param src url或 base64
|
|
4
|
-
*/
|
|
5
|
-
export declare function getImagePixel(src: string): Promise<{
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
image: HTMLImageElement;
|
|
9
|
-
} | undefined>;
|
|
10
|
-
/**
|
|
11
|
-
* 获取文件扩展名
|
|
12
|
-
* @param filename 文件名
|
|
13
|
-
*/
|
|
14
|
-
export declare function getFileExtension(filename: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* blob 转 file
|
|
17
|
-
* @param data
|
|
18
|
-
* @param filename
|
|
19
|
-
*/
|
|
20
|
-
export declare function blobToFile(data: File | Blob, filename: string): File;
|
|
21
|
-
export declare function generateUUID(): string;
|
package/es/util.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
function o(e) {
|
|
2
|
-
return new Promise((n) => {
|
|
3
|
-
const t = new Image();
|
|
4
|
-
t.onload = function() {
|
|
5
|
-
n({ width: t.width, height: t.height, image: t }), t.remove();
|
|
6
|
-
}, t.onerror = function(i) {
|
|
7
|
-
n(void 0), t.remove();
|
|
8
|
-
}, t.src = e;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
function r(e) {
|
|
12
|
-
const n = e.split(".");
|
|
13
|
-
return n ? n[n.length - 1] : "";
|
|
14
|
-
}
|
|
15
|
-
function c(e, n) {
|
|
16
|
-
return e.name ? e : new File([e], n, { type: e.type });
|
|
17
|
-
}
|
|
18
|
-
function g() {
|
|
19
|
-
const e = Date.now().toString(16), n = Math.random().toString(16).slice(2);
|
|
20
|
-
return `${e}-${n}`;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
c as blobToFile,
|
|
24
|
-
g as generateUUID,
|
|
25
|
-
r as getFileExtension,
|
|
26
|
-
o as getImagePixel
|
|
27
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { RawEditorOptions } from 'tinymce'
|
|
2
|
-
import _TinymceEditor from './editor.vue'
|
|
3
|
-
|
|
4
|
-
// 导入 ElementUI
|
|
5
|
-
import { Button, Slider, Dialog, Upload, Tag, Form, FormItem, ButtonGroup, Loading, InputNumber } from 'element-ui'
|
|
6
|
-
import { AudioUploadOptions, ImageUploadOptions, VideoUploadOptions } from './types'
|
|
7
|
-
|
|
8
|
-
interface TinymceEditorGlobalOptions {
|
|
9
|
-
/** 富文本编辑器选项 */
|
|
10
|
-
options?: RawEditorOptions;
|
|
11
|
-
|
|
12
|
-
/** 图片上传选项 */
|
|
13
|
-
imageUploadOptions?: ImageUploadOptions;
|
|
14
|
-
|
|
15
|
-
/** 音频上传选项 */
|
|
16
|
-
audioUploadOptions?: AudioUploadOptions;
|
|
17
|
-
|
|
18
|
-
/** 视频上传选项 */
|
|
19
|
-
videoUploadOptions?: VideoUploadOptions;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// 全局属性
|
|
23
|
-
const globalProps: TinymceEditorGlobalOptions = {}
|
|
24
|
-
|
|
25
|
-
const TinymceEditor = Object.assign(_TinymceEditor, {
|
|
26
|
-
install: (app: any, options?: TinymceEditorGlobalOptions) => {
|
|
27
|
-
// 合并
|
|
28
|
-
Object.assign(globalProps, (options || {}))
|
|
29
|
-
|
|
30
|
-
// 注入element-ui
|
|
31
|
-
app.use(Button)
|
|
32
|
-
app.use(Slider)
|
|
33
|
-
app.use(Dialog)
|
|
34
|
-
app.use(Upload)
|
|
35
|
-
app.use(Tag)
|
|
36
|
-
app.use(Form)
|
|
37
|
-
app.use(FormItem)
|
|
38
|
-
app.use(ButtonGroup)
|
|
39
|
-
app.use(InputNumber)
|
|
40
|
-
app.use(Loading)
|
|
41
|
-
|
|
42
|
-
// 注册组件
|
|
43
|
-
app.component('KbTinymceEditor', _TinymceEditor)
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
export { TinymceEditor, globalProps, type TinymceEditorGlobalOptions }
|
|
48
|
-
export default TinymceEditor
|
|
49
|
-
|
|
50
|
-
// 导出工具类
|
|
51
|
-
export * from './util'
|
|
52
|
-
|
|
53
|
-
// components.d.ts
|
|
54
|
-
export type {} from './components'
|
|
File without changes
|