@keyblade/tinymce-editor-vue2 1.0.4 → 1.2.0
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/editor.vue.d.ts +1 -1
- package/es/editor.vue2.js +17 -18
- package/es/index.d.ts +26 -27
- package/es/index.js +8 -13
- package/es/types.d.ts +1 -1
- package/package.json +3 -3
- package/es/util.d.ts +0 -21
- package/es/util.js +0 -27
- package/src/index.ts +0 -54
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.视频上传配置
|
package/es/editor.vue.d.ts
CHANGED
|
@@ -52,10 +52,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
52
52
|
extParameters: () => {};
|
|
53
53
|
options: () => {};
|
|
54
54
|
}>>>, {
|
|
55
|
-
options: Partial<RawEditorOptions>;
|
|
56
55
|
value: string;
|
|
57
56
|
disabled: boolean;
|
|
58
57
|
extParameters: Record<string, any>;
|
|
58
|
+
options: Partial<RawEditorOptions>;
|
|
59
59
|
}>;
|
|
60
60
|
export default _default;
|
|
61
61
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
package/es/editor.vue2.js
CHANGED
|
@@ -29,8 +29,7 @@ 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
|
-
import { blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "./util.js";
|
|
32
|
+
import { oneTravelImageCheckAndTransform as Fe, oneTravelImageCompressor as We, blobToFile as Ne, getImagePixel as Le, getFileExtension as Ge } from "@keyblade/one-travel";
|
|
34
33
|
import "./style.less.js";
|
|
35
34
|
import { conclude as F } from "vue-global-config";
|
|
36
35
|
import pe from "tinymce";
|
|
@@ -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: "" },
|
|
@@ -223,8 +222,8 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
223
222
|
for (const k of [...Te, ...ze])
|
|
224
223
|
k == null || k.remove();
|
|
225
224
|
try {
|
|
226
|
-
for (var ie = G([...se]), Ke,
|
|
227
|
-
const k =
|
|
225
|
+
for (var ie = G([...se]), Ke, Ra, qa; Ke = !(Ra = yield ie.next()).done; Ke = !1) {
|
|
226
|
+
const k = Ra.value;
|
|
228
227
|
if (k.removeAttribute("crossorigin"), k.src.startsWith("http"))
|
|
229
228
|
if ((l = p.value) != null && l.handleRequestByUrl) {
|
|
230
229
|
const x = yield (m = p.value) == null ? void 0 : m.handleRequestByUrl(k.src, { extParameters: i.extParameters });
|
|
@@ -236,14 +235,14 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
236
235
|
else
|
|
237
236
|
k.remove(), b.error("不支持Word中批量复制图片或视频,请改为单个复制,或者从工具栏中手动插入上传");
|
|
238
237
|
}
|
|
239
|
-
} catch (
|
|
240
|
-
|
|
238
|
+
} catch (Ra) {
|
|
239
|
+
qa = [Ra];
|
|
241
240
|
} finally {
|
|
242
241
|
try {
|
|
243
|
-
Ke && (
|
|
242
|
+
Ke && (Ra = ie.return) && (yield Ra.call(ie));
|
|
244
243
|
} finally {
|
|
245
|
-
if (
|
|
246
|
-
throw
|
|
244
|
+
if (qa)
|
|
245
|
+
throw qa[0];
|
|
247
246
|
}
|
|
248
247
|
}
|
|
249
248
|
$.value.show = !1;
|
|
@@ -264,22 +263,22 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
264
263
|
text: "图片上传中,请稍等"
|
|
265
264
|
};
|
|
266
265
|
try {
|
|
267
|
-
for (var
|
|
268
|
-
const z =
|
|
266
|
+
for (var Fa = G(r), Wa, Na, La; Wa = !(Na = yield Fa.next()).done; Wa = !1) {
|
|
267
|
+
const z = Na.value;
|
|
269
268
|
const q = yield ae(z);
|
|
270
269
|
if (q) {
|
|
271
270
|
const H = `<img src="${q}" alt="" />`;
|
|
272
271
|
e.insertContent(H);
|
|
273
272
|
}
|
|
274
273
|
}
|
|
275
|
-
} catch (
|
|
276
|
-
|
|
274
|
+
} catch (Na) {
|
|
275
|
+
La = [Na];
|
|
277
276
|
} finally {
|
|
278
277
|
try {
|
|
279
|
-
|
|
278
|
+
Wa && (Na = Fa.return) && (yield Na.call(Fa));
|
|
280
279
|
} finally {
|
|
281
|
-
if (
|
|
282
|
-
throw
|
|
280
|
+
if (La)
|
|
281
|
+
throw La[0];
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
284
|
$.value.show = !1;
|
|
@@ -545,5 +544,5 @@ const $a = /* @__PURE__ */ Ee({
|
|
|
545
544
|
}
|
|
546
545
|
});
|
|
547
546
|
export {
|
|
548
|
-
|
|
547
|
+
Ha as default
|
|
549
548
|
};
|
package/es/index.d.ts
CHANGED
|
@@ -13,10 +13,6 @@ interface TinymceEditorGlobalOptions {
|
|
|
13
13
|
}
|
|
14
14
|
declare const globalProps: TinymceEditorGlobalOptions;
|
|
15
15
|
declare const TinymceEditor: import('vue/types/v3-component-public-instance').ComponentPublicInstanceConstructor<import('vue/types/v3-component-public-instance').Vue3Instance<{}, Readonly<import('vue').ExtractPropTypes<{
|
|
16
|
-
options: {
|
|
17
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
18
|
-
default: () => {};
|
|
19
|
-
};
|
|
20
16
|
value: {
|
|
21
17
|
type: import('vue').PropType<string>;
|
|
22
18
|
default: string;
|
|
@@ -29,6 +25,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
29
25
|
type: import('vue').PropType<Record<string, any>>;
|
|
30
26
|
default: () => {};
|
|
31
27
|
};
|
|
28
|
+
options: {
|
|
29
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
30
|
+
default: () => {};
|
|
31
|
+
};
|
|
32
32
|
imageUploadOptions: {
|
|
33
33
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
34
34
|
};
|
|
@@ -44,10 +44,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
44
44
|
}) => void>;
|
|
45
45
|
};
|
|
46
46
|
}>>, Readonly<import('vue').ExtractPropTypes<{
|
|
47
|
-
options: {
|
|
48
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
49
|
-
default: () => {};
|
|
50
|
-
};
|
|
51
47
|
value: {
|
|
52
48
|
type: import('vue').PropType<string>;
|
|
53
49
|
default: string;
|
|
@@ -60,6 +56,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
60
56
|
type: import('vue').PropType<Record<string, any>>;
|
|
61
57
|
default: () => {};
|
|
62
58
|
};
|
|
59
|
+
options: {
|
|
60
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
61
|
+
default: () => {};
|
|
62
|
+
};
|
|
63
63
|
imageUploadOptions: {
|
|
64
64
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
65
65
|
};
|
|
@@ -77,15 +77,11 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
77
77
|
}>>, {
|
|
78
78
|
input: (value: string) => void;
|
|
79
79
|
}, {
|
|
80
|
-
options: Partial<RawEditorOptions>;
|
|
81
80
|
value: string;
|
|
82
81
|
disabled: boolean;
|
|
83
82
|
extParameters: Record<string, any>;
|
|
83
|
+
options: Partial<RawEditorOptions>;
|
|
84
84
|
}, true, import('vue/types/v3-component-options').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, any>> & Readonly<Readonly<import('vue').ExtractPropTypes<{
|
|
85
|
-
options: {
|
|
86
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
87
|
-
default: () => {};
|
|
88
|
-
};
|
|
89
85
|
value: {
|
|
90
86
|
type: import('vue').PropType<string>;
|
|
91
87
|
default: string;
|
|
@@ -98,6 +94,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
98
94
|
type: import('vue').PropType<Record<string, any>>;
|
|
99
95
|
default: () => {};
|
|
100
96
|
};
|
|
97
|
+
options: {
|
|
98
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
99
|
+
default: () => {};
|
|
100
|
+
};
|
|
101
101
|
imageUploadOptions: {
|
|
102
102
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
103
103
|
};
|
|
@@ -113,10 +113,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
113
113
|
}) => void>;
|
|
114
114
|
};
|
|
115
115
|
}>>> & import('vue').ShallowUnwrapRef<{}> & import('vue/types/v3-component-options').ExtractComputedReturns<{}> & import('vue').ComponentCustomProperties & Readonly<import('vue').ExtractPropTypes<{
|
|
116
|
-
options: {
|
|
117
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
118
|
-
default: () => {};
|
|
119
|
-
};
|
|
120
116
|
value: {
|
|
121
117
|
type: import('vue').PropType<string>;
|
|
122
118
|
default: string;
|
|
@@ -129,6 +125,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
129
125
|
type: import('vue').PropType<Record<string, any>>;
|
|
130
126
|
default: () => {};
|
|
131
127
|
};
|
|
128
|
+
options: {
|
|
129
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
130
|
+
default: () => {};
|
|
131
|
+
};
|
|
132
132
|
imageUploadOptions: {
|
|
133
133
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
134
134
|
};
|
|
@@ -144,10 +144,6 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
144
144
|
}) => void>;
|
|
145
145
|
};
|
|
146
146
|
}>>> & import('vue/types/v3-component-options').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
|
|
147
|
-
options: {
|
|
148
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
149
|
-
default: () => {};
|
|
150
|
-
};
|
|
151
147
|
value: {
|
|
152
148
|
type: import('vue').PropType<string>;
|
|
153
149
|
default: string;
|
|
@@ -160,6 +156,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
160
156
|
type: import('vue').PropType<Record<string, any>>;
|
|
161
157
|
default: () => {};
|
|
162
158
|
};
|
|
159
|
+
options: {
|
|
160
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
161
|
+
default: () => {};
|
|
162
|
+
};
|
|
163
163
|
imageUploadOptions: {
|
|
164
164
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
165
165
|
};
|
|
@@ -177,16 +177,12 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
177
177
|
}>>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {
|
|
178
178
|
input: (value: string) => void;
|
|
179
179
|
}, string, {
|
|
180
|
-
options: Partial<RawEditorOptions>;
|
|
181
180
|
value: string;
|
|
182
181
|
disabled: boolean;
|
|
183
182
|
extParameters: Record<string, any>;
|
|
183
|
+
options: Partial<RawEditorOptions>;
|
|
184
184
|
}> & {
|
|
185
185
|
props: {
|
|
186
|
-
options: {
|
|
187
|
-
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
188
|
-
default: () => {};
|
|
189
|
-
};
|
|
190
186
|
value: {
|
|
191
187
|
type: import('vue').PropType<string>;
|
|
192
188
|
default: string;
|
|
@@ -199,6 +195,10 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
199
195
|
type: import('vue').PropType<Record<string, any>>;
|
|
200
196
|
default: () => {};
|
|
201
197
|
};
|
|
198
|
+
options: {
|
|
199
|
+
type: import('vue').PropType<Partial<RawEditorOptions>>;
|
|
200
|
+
default: () => {};
|
|
201
|
+
};
|
|
202
202
|
imageUploadOptions: {
|
|
203
203
|
type: import('vue').PropType<ImageUploadOptions>;
|
|
204
204
|
};
|
|
@@ -219,5 +219,4 @@ declare const TinymceEditor: import('vue/types/v3-component-public-instance').Co
|
|
|
219
219
|
};
|
|
220
220
|
export { TinymceEditor, globalProps, type TinymceEditorGlobalOptions };
|
|
221
221
|
export default TinymceEditor;
|
|
222
|
-
export * from './util';
|
|
223
222
|
export type {} from './components';
|
package/es/index.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import './style.css';
|
|
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);
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/
|
|
1
|
+
import { ImageUploadCheckOptions, ImageUploadCompressorOptions, ImageUploadCropOptions } from '@keyblade/one-travel';
|
|
2
2
|
|
|
3
3
|
/** 图片选项 */
|
|
4
4
|
export interface ImageUploadOptions {
|
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
|
|
5
|
+
"version": "1.2.0",
|
|
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.1"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "vite build",
|
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'
|