@keyblade/tinymce-editor-vue2 0.0.11 → 0.0.12-alpha.10
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 +129 -38
- package/es/editor.vue.d.ts +127 -3
- package/es/editor.vue.js +18 -11
- package/es/editor.vue2.js +332 -126
- package/es/index.d.ts +543 -86
- package/es/index.js +11 -6
- package/es/style.css +1 -1
- package/es/util.d.ts +41 -0
- package/es/util.js +77 -0
- package/package.json +6 -3
- package/src/index.ts +35 -12
package/README.md
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
# tinymce 富文本编辑器
|
|
2
|
-
|
|
2
|
+
tinymce编辑器
|
|
3
|
+
|
|
4
|
+
## 前提
|
|
5
|
+
必须将vue 版本升级至2.7+,按如下文档操作,一般来说只需要升级 vue、及 @vue/cli-xxx 版本即可
|
|
6
|
+
|
|
7
|
+
升级指南:- https://v2.cn.vuejs.org/v2/guide/migration-vue-2-7.html
|
|
3
8
|
|
|
4
9
|
## 一、安装
|
|
5
10
|
```shell
|
|
6
11
|
yarn add @keyblade/tinymce-editor-vue2
|
|
12
|
+
# 下面两个第三方依赖注意版本,必须匹配,否则css样式有问题
|
|
13
|
+
yarn add pic-viewer@0.5.1 (如项目中已有,则忽略)
|
|
14
|
+
yarn add imgpond@0.6.2 (如项目中已有,则忽略)
|
|
7
15
|
```
|
|
8
16
|
|
|
9
17
|
## 二、使用
|
|
@@ -11,28 +19,62 @@ yarn add @keyblade/tinymce-editor-vue2
|
|
|
11
19
|
```typescript
|
|
12
20
|
import TinymceEditor from '@keyblade/tinymce-editor-vue2'
|
|
13
21
|
|
|
22
|
+
// 如原项目中,则不需要
|
|
23
|
+
import PicViewer from 'pic-viewer'
|
|
24
|
+
import 'pic-viewer/dist/style.css'
|
|
25
|
+
|
|
26
|
+
// 如原项目中,则不需要
|
|
27
|
+
import ImgPond from 'imgpond'
|
|
28
|
+
import 'imgpond/dist/style.css'
|
|
29
|
+
|
|
30
|
+
Vue.use(PicViewer, {})
|
|
31
|
+
Vue.use(ImgPond, {})
|
|
32
|
+
|
|
14
33
|
Vue.use(TinymceEditor, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
34
|
+
imageUploadHandle: (file, filename, parameters: { extParameters: Record<string, any> }) => {
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
resolve({
|
|
38
|
+
success: true,
|
|
39
|
+
url: 'https://object.gcongo.com.cn/onecode-travel/nonClassic/8cefe379c03b5f39cd8ef725293a3c02/2024/5/1715995588295/d0b5bb458b694130be0c63e2f1d0090b.png',
|
|
40
|
+
errorMessage: '',
|
|
41
|
+
})
|
|
42
|
+
}, 1000)
|
|
43
|
+
})
|
|
44
|
+
},
|
|
45
|
+
// 音频
|
|
46
|
+
audioUploadOptions: {
|
|
47
|
+
action: 'https://qt.gcongo.com.cn/msg/file/upload',
|
|
48
|
+
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
21
49
|
return {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
50
|
+
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
51
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
|
|
25
52
|
}
|
|
53
|
+
},
|
|
54
|
+
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
55
|
+
return {}
|
|
56
|
+
},
|
|
57
|
+
handlerResponse: (response: any) => {
|
|
58
|
+
return { url: response.data, errorMessage: response.msg }
|
|
26
59
|
}
|
|
27
60
|
},
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
61
|
+
// 视频
|
|
62
|
+
videoUploadOptions: {
|
|
63
|
+
action: 'https://qt.gcongo.com.cn/msg/file/upload',
|
|
64
|
+
headers: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
65
|
+
return {
|
|
66
|
+
Appkey: 'dsy_2AeyG8N0CqEC',
|
|
67
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJOelF4WW1jeU5qUmtabU5tTlRWaU9UUTZaREV6WkdOa1l6TXpZemt5WmpSbE16RXhNVEkyTVRJek9VeGJSRUpSTWpBPTlZNjNYN1dVRzNPQiIsImlzcyI6ImRlMjdkNDAzNzNiZjY3NGJkYTUyN2E5Yzg4NjliZTI1Iiwic3ViIjoiQVBQIiwiYXVkIjoiZHN5X1FPTXF2R0haU1MyZCIsImlhdCI6MTcxNjE5NDc4MSwiZXhwIjoxNzE2Nzk5NTgxfQ.krM-HWCvR-PLa6dcup6RGthxpST1pFrHN9cngyK89lU'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
data: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => {
|
|
71
|
+
return {
|
|
72
|
+
a: '1'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
handlerResponse: (response: any) => {
|
|
76
|
+
return { url: response.data, errorMessage: response.msg }
|
|
77
|
+
}
|
|
36
78
|
}
|
|
37
79
|
})
|
|
38
80
|
```
|
|
@@ -40,14 +82,14 @@ Vue.use(TinymceEditor, {
|
|
|
40
82
|
### 2.使用组件
|
|
41
83
|
```text
|
|
42
84
|
<template>
|
|
43
|
-
<
|
|
85
|
+
<KbTinymceEditor
|
|
44
86
|
v-model="text"
|
|
87
|
+
:extParameters="{a: 1}"
|
|
45
88
|
/>
|
|
46
89
|
</template>
|
|
47
90
|
|
|
48
91
|
<script setup lang="ts">
|
|
49
92
|
import { onMounted, ref } from 'vue'
|
|
50
|
-
import TinymceEditor from '@keyblade/tinymce-editor-vue2'
|
|
51
93
|
|
|
52
94
|
const text = ref<string>('')
|
|
53
95
|
|
|
@@ -57,21 +99,18 @@ onMounted(() => {
|
|
|
57
99
|
</script>
|
|
58
100
|
```
|
|
59
101
|
|
|
102
|
+
### 3.使用工具类(单独使用图片上传组件的,可使用这两个工具类自行处理)
|
|
103
|
+
```typescript
|
|
104
|
+
import { oneTravelImageCheck, oneTravelImageCompressor } from '@keyblade/tinymce-editor-vue2'
|
|
105
|
+
|
|
106
|
+
// oneTravelImageCheck: 一码游图片检测工具
|
|
107
|
+
// oneTravelImageCompressor: 一码游图片压缩工具
|
|
108
|
+
```
|
|
109
|
+
|
|
60
110
|
## 三、Api
|
|
61
111
|
### 1.全局属性
|
|
62
112
|
```typescript
|
|
63
113
|
interface TinymceEditorGlobalOptions {
|
|
64
|
-
// 消息方法实例
|
|
65
|
-
message?: {
|
|
66
|
-
// 加载中
|
|
67
|
-
loading?: (message?: string) => { close: () => void }
|
|
68
|
-
// 成功
|
|
69
|
-
success?: (message?: string) => void
|
|
70
|
-
// 错误提示
|
|
71
|
-
error?: (message?: string) => void
|
|
72
|
-
// 销毁
|
|
73
|
-
destroy?: () => void
|
|
74
|
-
}
|
|
75
114
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
76
115
|
imageUploadHandle?: (file: File | Blob, filename: string, options?: {
|
|
77
116
|
extParameters?: Record<string, any>
|
|
@@ -86,20 +125,41 @@ interface TinymceEditorGlobalOptions {
|
|
|
86
125
|
node: HTMLElement;
|
|
87
126
|
readonly internal: boolean;
|
|
88
127
|
}) => void;
|
|
89
|
-
|
|
90
|
-
|
|
128
|
+
tinymceOptions?: RawEditorOptions;
|
|
129
|
+
/** imgPond 选项 */
|
|
130
|
+
imgPondOptions?: Record<string, any>
|
|
131
|
+
/** 音频上传选项 */
|
|
132
|
+
audioUploadOptions?: {
|
|
133
|
+
action: string;
|
|
134
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
135
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
136
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
137
|
+
},
|
|
138
|
+
/** 视频上传选项 */
|
|
139
|
+
videoUploadOptions?: {
|
|
140
|
+
action: string;
|
|
141
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
142
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
143
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
144
|
+
}
|
|
91
145
|
}
|
|
92
146
|
```
|
|
93
147
|
|
|
94
|
-
### 2
|
|
148
|
+
### 2.组件属性
|
|
95
149
|
```typescript
|
|
96
150
|
interface ComponentProps {
|
|
97
151
|
/** vue2 v-model */
|
|
98
152
|
value?: string
|
|
99
153
|
/** vue3 v-model */
|
|
100
|
-
modelValue?: string
|
|
154
|
+
modelValue?: string;
|
|
101
155
|
/** 是否禁止编辑 */
|
|
102
156
|
disabled?: boolean;
|
|
157
|
+
/** 额外参数 */
|
|
158
|
+
extParameters?: Record<string, any>,
|
|
159
|
+
/** 图片上传组件最大数量 */
|
|
160
|
+
imageUploadMaxCount?: number;
|
|
161
|
+
/** 图片上传提示 */
|
|
162
|
+
imageUploadTip?: string;
|
|
103
163
|
/** 图片最大值(单位M,主要用于错误提示) */
|
|
104
164
|
imageMaxSize?: number;
|
|
105
165
|
/** 图片允许的类型 */
|
|
@@ -114,8 +174,36 @@ interface ComponentProps {
|
|
|
114
174
|
imageMaxWidth?: number;
|
|
115
175
|
/** 图片最大高度 */
|
|
116
176
|
imageMaxHeight?: number;
|
|
177
|
+
/** 是否开启音频 */
|
|
178
|
+
audioEnable?: boolean
|
|
179
|
+
/** 音频最大尺寸(M) */
|
|
180
|
+
audioMaxSize?: number;
|
|
181
|
+
/** 音频结尾格式 */
|
|
182
|
+
audioAllowedType?: string[];
|
|
183
|
+
/** 音频上传选项 */
|
|
184
|
+
audioUploadOptions?: {
|
|
185
|
+
action: string;
|
|
186
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
187
|
+
headers?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
188
|
+
data?: (parameters: { file: File | Blob, extParameters: Record<string, any> }) => Record<string, any>;
|
|
189
|
+
},
|
|
190
|
+
/** 是否开启视频 */
|
|
191
|
+
videoEnable?: boolean
|
|
192
|
+
/** 视频最大尺寸(M) */
|
|
193
|
+
videoMaxSize?: number;
|
|
194
|
+
/** 视频结尾格式 */
|
|
195
|
+
videoAllowedType?: string[];
|
|
196
|
+
/** 视频上传选项 */
|
|
197
|
+
videoUploadOptions?: {
|
|
198
|
+
action: string;
|
|
199
|
+
handlerResponse: (response: any) => { url?: string; errorMessage?: string }
|
|
200
|
+
headers?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
201
|
+
data?: (parameters: { file: File | Blob, extParameters: {} }) => Record<string, any>;
|
|
202
|
+
}
|
|
117
203
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
118
|
-
imageUploadHandle?: (file: File | Blob, filename: string
|
|
204
|
+
imageUploadHandle?: (file: File | Blob, filename: string, options?: {
|
|
205
|
+
extParameters?: Record<string, any>
|
|
206
|
+
}) => Promise<{success: boolean; url?: string; errorMessage?: string}>;
|
|
119
207
|
/** 接着默认配置进行处理 */
|
|
120
208
|
paste_preprocess?: (editor: Editor, args: {
|
|
121
209
|
content: string;
|
|
@@ -128,7 +216,10 @@ interface ComponentProps {
|
|
|
128
216
|
}) => void;
|
|
129
217
|
/** 初始化完成 */
|
|
130
218
|
initComplete?: (params: { editorIns: Editor }) => void,
|
|
131
|
-
/**
|
|
219
|
+
/** 富文本编辑器选项 */
|
|
132
220
|
options?: Partial<RawEditorOptions>
|
|
221
|
+
/** imgPond 选项 */
|
|
222
|
+
imgPondOptions?: Record<string, any>
|
|
133
223
|
}
|
|
134
|
-
```
|
|
224
|
+
```
|
|
225
|
+
|
package/es/editor.vue.d.ts
CHANGED
|
@@ -9,6 +9,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
9
9
|
disabled?: boolean | undefined;
|
|
10
10
|
/** 额外参数 */
|
|
11
11
|
extParameters?: Record<string, any> | undefined;
|
|
12
|
+
/** 图片上传组件最大数量 */
|
|
13
|
+
imageUploadMaxCount?: number | undefined;
|
|
14
|
+
/** 图片上传提示 */
|
|
15
|
+
imageUploadTip?: string | undefined;
|
|
12
16
|
/** 图片最大值(单位M,主要用于错误提示) */
|
|
13
17
|
imageMaxSize?: number | undefined;
|
|
14
18
|
/** 图片允许的类型 */
|
|
@@ -23,6 +27,50 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
23
27
|
imageMaxWidth?: number | undefined;
|
|
24
28
|
/** 图片最大高度 */
|
|
25
29
|
imageMaxHeight?: number | undefined;
|
|
30
|
+
/** 是否开启音频 */
|
|
31
|
+
audioEnable?: boolean | undefined;
|
|
32
|
+
/** 音频最大尺寸(M) */
|
|
33
|
+
audioMaxSize?: number | undefined;
|
|
34
|
+
/** 音频结尾格式 */
|
|
35
|
+
audioAllowedType?: string[] | undefined;
|
|
36
|
+
/** 音频上传选项 */
|
|
37
|
+
audioUploadOptions?: {
|
|
38
|
+
action: string;
|
|
39
|
+
handlerResponse: (response: any) => {
|
|
40
|
+
url?: string;
|
|
41
|
+
errorMessage?: string;
|
|
42
|
+
};
|
|
43
|
+
headers?: ((parameters: {
|
|
44
|
+
file: File | Blob;
|
|
45
|
+
extParameters: Record<string, any>;
|
|
46
|
+
}) => Record<string, any>) | undefined;
|
|
47
|
+
data?: ((parameters: {
|
|
48
|
+
file: File | Blob;
|
|
49
|
+
extParameters: Record<string, any>;
|
|
50
|
+
}) => Record<string, any>) | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
/** 是否开启视频 */
|
|
53
|
+
videoEnable?: boolean | undefined;
|
|
54
|
+
/** 视频最大尺寸(M) */
|
|
55
|
+
videoMaxSize?: number | undefined;
|
|
56
|
+
/** 视频结尾格式 */
|
|
57
|
+
videoAllowedType?: string[] | undefined;
|
|
58
|
+
/** 视频上传选项 */
|
|
59
|
+
videoUploadOptions?: {
|
|
60
|
+
action: string;
|
|
61
|
+
handlerResponse: (response: any) => {
|
|
62
|
+
url?: string;
|
|
63
|
+
errorMessage?: string;
|
|
64
|
+
};
|
|
65
|
+
headers?: ((parameters: {
|
|
66
|
+
file: File | Blob;
|
|
67
|
+
extParameters: {};
|
|
68
|
+
}) => Record<string, any>) | undefined;
|
|
69
|
+
data?: ((parameters: {
|
|
70
|
+
file: File | Blob;
|
|
71
|
+
extParameters: {};
|
|
72
|
+
}) => Record<string, any>) | undefined;
|
|
73
|
+
} | undefined;
|
|
26
74
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
27
75
|
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
28
76
|
extParameters?: Record<string, any>;
|
|
@@ -47,9 +95,13 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
47
95
|
}) => void) | undefined;
|
|
48
96
|
/** 富文本编辑器选项 */
|
|
49
97
|
options?: Partial<RawEditorOptions> | undefined;
|
|
98
|
+
/** imgPond 选项 */
|
|
99
|
+
imgPondOptions?: Record<string, any> | undefined;
|
|
50
100
|
}>, {
|
|
51
101
|
value: string;
|
|
52
102
|
modelValue: string;
|
|
103
|
+
imageUploadMaxCount: number;
|
|
104
|
+
imageUploadTip: string;
|
|
53
105
|
imageMaxSize: number;
|
|
54
106
|
imageAllowedType: () => string[];
|
|
55
107
|
imageAllowedMineType: () => string[];
|
|
@@ -57,6 +109,12 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
57
109
|
imageMinHeight: number;
|
|
58
110
|
imageMaxWidth: number;
|
|
59
111
|
imageMaxHeight: number;
|
|
112
|
+
audioEnable: boolean;
|
|
113
|
+
videoEnable: boolean;
|
|
114
|
+
audioMaxSize: number;
|
|
115
|
+
videoMaxSize: number;
|
|
116
|
+
audioAllowedType: () => string[];
|
|
117
|
+
videoAllowedType: () => string[];
|
|
60
118
|
options: () => {};
|
|
61
119
|
}>, {}, {}, {}, {}, import('vue/types/v3-component-options').ComponentOptionsMixin, import('vue/types/v3-component-options').ComponentOptionsMixin, {
|
|
62
120
|
input: (value: string) => void;
|
|
@@ -70,6 +128,10 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
70
128
|
disabled?: boolean | undefined;
|
|
71
129
|
/** 额外参数 */
|
|
72
130
|
extParameters?: Record<string, any> | undefined;
|
|
131
|
+
/** 图片上传组件最大数量 */
|
|
132
|
+
imageUploadMaxCount?: number | undefined;
|
|
133
|
+
/** 图片上传提示 */
|
|
134
|
+
imageUploadTip?: string | undefined;
|
|
73
135
|
/** 图片最大值(单位M,主要用于错误提示) */
|
|
74
136
|
imageMaxSize?: number | undefined;
|
|
75
137
|
/** 图片允许的类型 */
|
|
@@ -84,6 +146,50 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
84
146
|
imageMaxWidth?: number | undefined;
|
|
85
147
|
/** 图片最大高度 */
|
|
86
148
|
imageMaxHeight?: number | undefined;
|
|
149
|
+
/** 是否开启音频 */
|
|
150
|
+
audioEnable?: boolean | undefined;
|
|
151
|
+
/** 音频最大尺寸(M) */
|
|
152
|
+
audioMaxSize?: number | undefined;
|
|
153
|
+
/** 音频结尾格式 */
|
|
154
|
+
audioAllowedType?: string[] | undefined;
|
|
155
|
+
/** 音频上传选项 */
|
|
156
|
+
audioUploadOptions?: {
|
|
157
|
+
action: string;
|
|
158
|
+
handlerResponse: (response: any) => {
|
|
159
|
+
url?: string;
|
|
160
|
+
errorMessage?: string;
|
|
161
|
+
};
|
|
162
|
+
headers?: ((parameters: {
|
|
163
|
+
file: File | Blob;
|
|
164
|
+
extParameters: Record<string, any>;
|
|
165
|
+
}) => Record<string, any>) | undefined;
|
|
166
|
+
data?: ((parameters: {
|
|
167
|
+
file: File | Blob;
|
|
168
|
+
extParameters: Record<string, any>;
|
|
169
|
+
}) => Record<string, any>) | undefined;
|
|
170
|
+
} | undefined;
|
|
171
|
+
/** 是否开启视频 */
|
|
172
|
+
videoEnable?: boolean | undefined;
|
|
173
|
+
/** 视频最大尺寸(M) */
|
|
174
|
+
videoMaxSize?: number | undefined;
|
|
175
|
+
/** 视频结尾格式 */
|
|
176
|
+
videoAllowedType?: string[] | undefined;
|
|
177
|
+
/** 视频上传选项 */
|
|
178
|
+
videoUploadOptions?: {
|
|
179
|
+
action: string;
|
|
180
|
+
handlerResponse: (response: any) => {
|
|
181
|
+
url?: string;
|
|
182
|
+
errorMessage?: string;
|
|
183
|
+
};
|
|
184
|
+
headers?: ((parameters: {
|
|
185
|
+
file: File | Blob;
|
|
186
|
+
extParameters: {};
|
|
187
|
+
}) => Record<string, any>) | undefined;
|
|
188
|
+
data?: ((parameters: {
|
|
189
|
+
file: File | Blob;
|
|
190
|
+
extParameters: {};
|
|
191
|
+
}) => Record<string, any>) | undefined;
|
|
192
|
+
} | undefined;
|
|
87
193
|
/** 图片上传请求处理,需要返回图片地址 */
|
|
88
194
|
imageUploadHandle?: ((file: File | Blob, filename: string, options?: {
|
|
89
195
|
extParameters?: Record<string, any>;
|
|
@@ -108,9 +214,13 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
108
214
|
}) => void) | undefined;
|
|
109
215
|
/** 富文本编辑器选项 */
|
|
110
216
|
options?: Partial<RawEditorOptions> | undefined;
|
|
217
|
+
/** imgPond 选项 */
|
|
218
|
+
imgPondOptions?: Record<string, any> | undefined;
|
|
111
219
|
}>, {
|
|
112
220
|
value: string;
|
|
113
221
|
modelValue: string;
|
|
222
|
+
imageUploadMaxCount: number;
|
|
223
|
+
imageUploadTip: string;
|
|
114
224
|
imageMaxSize: number;
|
|
115
225
|
imageAllowedType: () => string[];
|
|
116
226
|
imageAllowedMineType: () => string[];
|
|
@@ -118,17 +228,31 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
118
228
|
imageMinHeight: number;
|
|
119
229
|
imageMaxWidth: number;
|
|
120
230
|
imageMaxHeight: number;
|
|
231
|
+
audioEnable: boolean;
|
|
232
|
+
videoEnable: boolean;
|
|
233
|
+
audioMaxSize: number;
|
|
234
|
+
videoMaxSize: number;
|
|
235
|
+
audioAllowedType: () => string[];
|
|
236
|
+
videoAllowedType: () => string[];
|
|
121
237
|
options: () => {};
|
|
122
238
|
}>>>, {
|
|
123
|
-
value: string;
|
|
124
|
-
modelValue: string;
|
|
125
239
|
imageMaxSize: number;
|
|
126
|
-
imageAllowedType: string[];
|
|
127
240
|
imageAllowedMineType: string[];
|
|
128
241
|
imageMinWidth: number;
|
|
129
242
|
imageMinHeight: number;
|
|
130
243
|
imageMaxWidth: number;
|
|
131
244
|
imageMaxHeight: number;
|
|
245
|
+
value: string;
|
|
246
|
+
modelValue: string;
|
|
247
|
+
imageUploadMaxCount: number;
|
|
248
|
+
imageUploadTip: string;
|
|
249
|
+
imageAllowedType: string[];
|
|
250
|
+
audioEnable: boolean;
|
|
251
|
+
audioMaxSize: number;
|
|
252
|
+
audioAllowedType: string[];
|
|
253
|
+
videoEnable: boolean;
|
|
254
|
+
videoMaxSize: number;
|
|
255
|
+
videoAllowedType: string[];
|
|
132
256
|
options: Partial<RawEditorOptions>;
|
|
133
257
|
}>;
|
|
134
258
|
export default _default;
|
package/es/editor.vue.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u from "./editor.vue2.js";
|
|
2
2
|
import "./editor.vue3.js";
|
|
3
|
-
import
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
}, o
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import i from "./_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var d = function() {
|
|
5
|
+
var l;
|
|
6
|
+
var e = this, a = e._self._c, o = e._self._setupProxy;
|
|
7
|
+
return a("div", { staticClass: "tinymce-editor" }, [a("textarea", { ref: "insRef" }), e._v(" "), a("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-image-dialog", attrs: { visible: o.uploadImage.dialogVisible, title: "插入图片", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadImageClose } }, [a("el-form", { ref: "uploadImageFormRef", staticClass: "uploadImageForm", attrs: { model: o.uploadImage.formData } }, [a("el-form-item", { attrs: { prop: "images", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", accept: o.imgPondAccept, size: e.imageMaxSize, count: e.imageUploadMaxCount, upload: o.onImageUploadUpload }, model: { value: o.uploadImage.formData.images, callback: function(t) {
|
|
8
|
+
e.$set(o.uploadImage.formData, "images", t);
|
|
9
|
+
}, expression: "uploadImage.formData.images" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("div", { staticClass: "tips" }, [a("span", { staticStyle: { "font-size": "15px", "font-weight": "bold" } }, [e._v("注意:")]), a("span", [e._v("1. 单次最多可同时选择" + e._s(e.imageUploadMaxCount) + "张图片")]), a("span", [e._v("2. 仅支持" + e._s(e.imageAllowedType.map((t) => t.toUpperCase()).join("、")) + "格式")]), a("span", [e._v("3. 单张图片大小不可超过" + e._s(e.imageMaxSize) + "M")]), a("span", [e._v("4. 像素不低于" + e._s(e.imageMinWidth) + "*" + e._s(e.imageMinHeight) + "且像素不高于" + e._s(e.imageMaxWidth) + "*" + e._s(e.imageMaxHeight))])])], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadImageClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadImageConfirm } }, [e._v("确定")])], 1)], 1), a("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-audio-dialog", attrs: { visible: o.uploadAudio.dialogVisible, title: "插入音频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadAudioClose } }, [a("el-form", { ref: "uploadAudioFormRef", staticClass: "uploadAudioForm", attrs: { model: o.uploadAudio.formData, "label-width": "auto" } }, [a("el-form-item", { attrs: { label: "名称", prop: "name", rules: { required: !0, message: "必填项" } } }, [a("el-input", { attrs: { maxlength: "14", "show-word-limit": "", placeholder: "请输入" }, model: { value: o.uploadAudio.formData.name, callback: function(t) {
|
|
10
|
+
e.$set(o.uploadAudio.formData, "name", t);
|
|
11
|
+
}, expression: "uploadAudio.formData.name" } })], 1), a("el-form-item", { attrs: { label: "封面", prop: "cover", rules: { required: !0, message: "必填项" } } }, [a(o.ImgPond, e._b({ attrs: { valueType: "array", size: e.imageMaxSize, accept: o.imgPondAccept, count: 1, upload: o.onImageUploadUpload }, model: { value: o.uploadAudio.formData.cover, callback: function(t) {
|
|
12
|
+
e.$set(o.uploadAudio.formData, "cover", t);
|
|
13
|
+
}, expression: "uploadAudio.formData.cover" } }, "ImgPond", o.mergeImgPondOptions, !1))], 1), a("el-form-item", { attrs: { label: "音频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("el-upload", { class: ["upload", { "upload-hide": o.uploadAudio.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadAudio.formData.file, action: ((l = o.mergeAudioUploadOptions) == null ? void 0 : l.action) || "", data: o.getUploadAudioData(), accept: "audio/*", "list-type": "headTextContent", "before-upload": o.onUploadAudioBeforeUpload, headers: o.getUploadAudioHeaders(), "on-remove": o.onUploadAudioRemove, "on-success": o.onUploadAudioSuccess, "on-error": o.onUploadAudioError, limit: 1 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持音频格式:" + e._s(e.audioAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadAudioClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadAudioConfirm } }, [e._v("确定")])], 1)], 1), a("el-dialog", { staticClass: "tinymce-editor-dialog tinymce-editor-upload-video-dialog", attrs: { visible: o.uploadVideo.dialogVisible, title: "插入视频", "append-to-body": !0, "close-on-click-modal": !1, "destroy-on-close": "" }, on: { close: o.onUploadVideoClose } }, [a("el-form", { ref: "uploadVideoFormRef", staticClass: "uploadVideoForm", attrs: { model: o.uploadVideo.formData, "label-width": "auto" } }, [a("el-form-item", { attrs: { label: "视频", prop: "file", rules: { required: !0, message: "必填项" } } }, [a("el-upload", { class: ["upload", { "upload-hide": o.uploadVideo.formData.file.length >= 1 }], attrs: { name: "file", "file-list": o.uploadVideo.formData.file, action: o.mergeVideoUploadOptions.action || "", data: o.getUploadVideoData(), accept: "video/*", "list-type": "headTextContent", "before-upload": o.onUploadVideoBeforeUpload, headers: o.getUploadVideoHeaders(), "on-remove": o.onUploadVideoRemove, "on-success": o.onUploadVideoSuccess, "on-error": o.onUploadVideoError, limit: 1 } }, [a("el-button", { attrs: { size: "small", type: "primary" } }, [e._v("上传文件"), a("i", { staticClass: "el-icon-upload el-icon--right" })]), a("div", { staticClass: "el-upload__tip", attrs: { slot: "tip" }, slot: "tip" }, [e._v("支持视频格式:" + e._s(e.videoAllowedType.join("、")))])], 1)], 1)], 1), a("div", { attrs: { slot: "footer" }, slot: "footer" }, [a("el-button", { on: { click: o.onUploadVideoClose } }, [e._v("取消")]), a("el-button", { attrs: { type: "primary" }, on: { click: o.onUploadVideoConfirm } }, [e._v("确定")])], 1)], 1)], 1);
|
|
14
|
+
}, s = [], r = /* @__PURE__ */ i(
|
|
15
|
+
u,
|
|
16
|
+
d,
|
|
17
|
+
s
|
|
11
18
|
);
|
|
12
|
-
const
|
|
19
|
+
const f = r.exports;
|
|
13
20
|
export {
|
|
14
|
-
|
|
21
|
+
f as default
|
|
15
22
|
};
|