mme-editor 1.1.12 → 1.1.13
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 +92 -92
- package/dist/mme-editor.js +12207 -11989
- package/dist/style.css +1 -1
- package/package.json +209 -209
- package/types/index.d.ts +251 -251
package/types/index.d.ts
CHANGED
|
@@ -1,251 +1,251 @@
|
|
|
1
|
-
import type { Extension } from '@tiptap/core'
|
|
2
|
-
import type { AsyncFunction } from '@tool-belt/type-predicates'
|
|
3
|
-
|
|
4
|
-
export type SupportedLocale = 'en-US' | 'zh-CN' | 'ru-RU'
|
|
5
|
-
export interface MarginOption {
|
|
6
|
-
left: number
|
|
7
|
-
right: number
|
|
8
|
-
top: number
|
|
9
|
-
bottom: number
|
|
10
|
-
}
|
|
11
|
-
export interface WatermarkOption {
|
|
12
|
-
type: string
|
|
13
|
-
alpha: number
|
|
14
|
-
fontColor: string
|
|
15
|
-
fontSize: number
|
|
16
|
-
fontFamily: string
|
|
17
|
-
fontWeight: string
|
|
18
|
-
text: string
|
|
19
|
-
}
|
|
20
|
-
export interface PageOption {
|
|
21
|
-
defaultMargin?: MarginOption
|
|
22
|
-
defaultOrientation?: string
|
|
23
|
-
defaultBackground?: string
|
|
24
|
-
showBreakMarks?: boolean
|
|
25
|
-
showBookmark?: boolean
|
|
26
|
-
adaptive?: boolean
|
|
27
|
-
watermark?: WatermarkOption
|
|
28
|
-
size?: {
|
|
29
|
-
width: number
|
|
30
|
-
height: number
|
|
31
|
-
label?: LocaleLabel
|
|
32
|
-
}
|
|
33
|
-
margin?: {
|
|
34
|
-
right: number
|
|
35
|
-
left: number
|
|
36
|
-
bottom: number
|
|
37
|
-
top: number
|
|
38
|
-
layout?: 'narrow' | 'moderate' | 'wide' | 'custom'
|
|
39
|
-
}
|
|
40
|
-
orientation?: string
|
|
41
|
-
background?: string
|
|
42
|
-
header?: boolean
|
|
43
|
-
footer?: boolean
|
|
44
|
-
showLineNumber?: boolean
|
|
45
|
-
showToc?: boolean
|
|
46
|
-
zoomLevel?: number
|
|
47
|
-
bodyHeight?: number
|
|
48
|
-
autoWidth?: boolean
|
|
49
|
-
preview?: {
|
|
50
|
-
enabled?: boolean
|
|
51
|
-
laserPointer?: boolean
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type ToolbarMenu =
|
|
56
|
-
| 'base'
|
|
57
|
-
| 'insert'
|
|
58
|
-
| 'table'
|
|
59
|
-
| 'tools'
|
|
60
|
-
| 'page'
|
|
61
|
-
| 'export'
|
|
62
|
-
| 'advanced'
|
|
63
|
-
| 'custom'
|
|
64
|
-
|
|
65
|
-
export interface ToolbarOptions {
|
|
66
|
-
defaultMode: 'classic' | 'ribbon'
|
|
67
|
-
enableSourceEditor: boolean
|
|
68
|
-
showToolbarMode: boolean
|
|
69
|
-
fromType: string
|
|
70
|
-
menus: ToolbarMenu[]
|
|
71
|
-
disableMenuItems: string[]
|
|
72
|
-
importWord: {
|
|
73
|
-
enabled: boolean
|
|
74
|
-
options: unknown
|
|
75
|
-
useCustomMethod?: boolean
|
|
76
|
-
onCustomImportWordMethod?: (file: File) => Promise<{
|
|
77
|
-
id: string
|
|
78
|
-
url: string
|
|
79
|
-
value: string
|
|
80
|
-
messages: { type: string; message: string }
|
|
81
|
-
}>
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface AutoSaveOptions {
|
|
86
|
-
enabled: boolean
|
|
87
|
-
interval: number
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface DocumentOptions {
|
|
91
|
-
id?: string
|
|
92
|
-
title: string
|
|
93
|
-
content: string
|
|
94
|
-
placeholder?: Record<string, string>
|
|
95
|
-
enableSpellcheck?: boolean
|
|
96
|
-
enableMarkdown?: boolean
|
|
97
|
-
enableBubbleMenu?: boolean
|
|
98
|
-
enableBlockMenu?: boolean
|
|
99
|
-
// enableComment?: boolean
|
|
100
|
-
readOnly?: boolean
|
|
101
|
-
autofocus?: 'start' | 'end' | 'all' | number | boolean | null
|
|
102
|
-
characterLimit?: number
|
|
103
|
-
typographyRules?: Record<string, unknown>
|
|
104
|
-
editorProps?: Record<string, unknown>
|
|
105
|
-
parseOptions?: Record<string, unknown>
|
|
106
|
-
autoSave?: AutoSaveOptions
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export type LocaleLabel =
|
|
110
|
-
| string
|
|
111
|
-
| { en_US: string; zh_CN: string; ru_RU: string }
|
|
112
|
-
|
|
113
|
-
export interface PageSize {
|
|
114
|
-
label: LocaleLabel
|
|
115
|
-
width: number
|
|
116
|
-
height: number
|
|
117
|
-
default?: boolean
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface Font {
|
|
121
|
-
label: LocaleLabel
|
|
122
|
-
value: string | null
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface LineHeight {
|
|
126
|
-
label: LocaleLabel
|
|
127
|
-
value: number
|
|
128
|
-
default?: boolean
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface GraphicSymbol {
|
|
132
|
-
label: LocaleLabel
|
|
133
|
-
items: string
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export interface Emoji {
|
|
137
|
-
label: LocaleLabel
|
|
138
|
-
items: string
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface Template {
|
|
142
|
-
title: string
|
|
143
|
-
content: string
|
|
144
|
-
description?: string
|
|
145
|
-
value: string
|
|
146
|
-
divider?: boolean
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface AssistantOptions {
|
|
150
|
-
maxlength: number
|
|
151
|
-
commands: CommandItem[]
|
|
152
|
-
enabled: boolean
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface EchartsOptions {
|
|
156
|
-
isRelative: boolean
|
|
157
|
-
cdnUrl: string
|
|
158
|
-
filePath: string
|
|
159
|
-
mode: number
|
|
160
|
-
haveImage: boolean
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface UserItem {
|
|
164
|
-
id: string
|
|
165
|
-
name: string
|
|
166
|
-
avatar?: string
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export interface WebPageItem {
|
|
170
|
-
label: LocaleLabel
|
|
171
|
-
icon: string
|
|
172
|
-
validate(url: string): boolean
|
|
173
|
-
transformURL?(url: string): string
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export interface CommandItem {
|
|
177
|
-
label: LocaleLabel
|
|
178
|
-
value: LocaleLabel
|
|
179
|
-
autoSend?: boolean
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface AssistantPayload {
|
|
183
|
-
lang: string
|
|
184
|
-
input: string
|
|
185
|
-
command: string
|
|
186
|
-
output: string
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface AssistantContent {
|
|
190
|
-
html: string
|
|
191
|
-
text: string
|
|
192
|
-
json: unknown
|
|
193
|
-
}
|
|
194
|
-
export interface AssistantResult {
|
|
195
|
-
prompt: string
|
|
196
|
-
content: string
|
|
197
|
-
error: boolean
|
|
198
|
-
command?: string
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export interface FileOptions {
|
|
202
|
-
allowedMimeTypes: string[]
|
|
203
|
-
maxSize: number
|
|
204
|
-
preview: {
|
|
205
|
-
extensions?: string[]
|
|
206
|
-
url: string
|
|
207
|
-
}[]
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export interface UmoEditorOptions {
|
|
211
|
-
editorKey: string
|
|
212
|
-
locale: SupportedLocale
|
|
213
|
-
theme: 'light' | 'dark'
|
|
214
|
-
height: string
|
|
215
|
-
fullscreenZIndex: number
|
|
216
|
-
dicts?: {
|
|
217
|
-
pageSizes: PageSize[]
|
|
218
|
-
fonts: Font[]
|
|
219
|
-
colors: string[]
|
|
220
|
-
lineHeights: LineHeight[]
|
|
221
|
-
symbols: GraphicSymbol[]
|
|
222
|
-
emojis: Emoji[]
|
|
223
|
-
}
|
|
224
|
-
toolbar?: ToolbarOptions
|
|
225
|
-
page: PageOption
|
|
226
|
-
document?: DocumentOptions
|
|
227
|
-
assistant?: AssistantOptions
|
|
228
|
-
echarts?: EchartsOptions
|
|
229
|
-
webPages?: WebPageItem[]
|
|
230
|
-
templates?: Template[]
|
|
231
|
-
cdnUrl?: string
|
|
232
|
-
baseUrl?: string
|
|
233
|
-
noReplaceImgUrl?: string
|
|
234
|
-
shareUrl?: string
|
|
235
|
-
diagrams?: Record<string, unknown>
|
|
236
|
-
mindmap?: Record<string, unknown>
|
|
237
|
-
plantuml?: Record<string, unknown>
|
|
238
|
-
file?: FileOptions
|
|
239
|
-
user?: Record<string, unknown>
|
|
240
|
-
users?: UserItem[]
|
|
241
|
-
extensions?: Extension[]
|
|
242
|
-
translations?: Record<string, unknown>
|
|
243
|
-
onSave?: AsyncFunction
|
|
244
|
-
onFileUpload?: (file: File) => Promise<{ id: string; url: string }>
|
|
245
|
-
onFileDelete?: CallableFunction
|
|
246
|
-
onCustomizeChartSettings?: CallableFunction
|
|
247
|
-
onAssistant?: AsyncFunction
|
|
248
|
-
onCustomImportWordMethod?: AsyncFunction
|
|
249
|
-
initFetchUsers?: AsyncFunction
|
|
250
|
-
fetchReplaceUrl?: AsyncFunction
|
|
251
|
-
}
|
|
1
|
+
import type { Extension } from '@tiptap/core'
|
|
2
|
+
import type { AsyncFunction } from '@tool-belt/type-predicates'
|
|
3
|
+
|
|
4
|
+
export type SupportedLocale = 'en-US' | 'zh-CN' | 'ru-RU'
|
|
5
|
+
export interface MarginOption {
|
|
6
|
+
left: number
|
|
7
|
+
right: number
|
|
8
|
+
top: number
|
|
9
|
+
bottom: number
|
|
10
|
+
}
|
|
11
|
+
export interface WatermarkOption {
|
|
12
|
+
type: string
|
|
13
|
+
alpha: number
|
|
14
|
+
fontColor: string
|
|
15
|
+
fontSize: number
|
|
16
|
+
fontFamily: string
|
|
17
|
+
fontWeight: string
|
|
18
|
+
text: string
|
|
19
|
+
}
|
|
20
|
+
export interface PageOption {
|
|
21
|
+
defaultMargin?: MarginOption
|
|
22
|
+
defaultOrientation?: string
|
|
23
|
+
defaultBackground?: string
|
|
24
|
+
showBreakMarks?: boolean
|
|
25
|
+
showBookmark?: boolean
|
|
26
|
+
adaptive?: boolean
|
|
27
|
+
watermark?: WatermarkOption
|
|
28
|
+
size?: {
|
|
29
|
+
width: number
|
|
30
|
+
height: number
|
|
31
|
+
label?: LocaleLabel
|
|
32
|
+
}
|
|
33
|
+
margin?: {
|
|
34
|
+
right: number
|
|
35
|
+
left: number
|
|
36
|
+
bottom: number
|
|
37
|
+
top: number
|
|
38
|
+
layout?: 'narrow' | 'moderate' | 'wide' | 'custom'
|
|
39
|
+
}
|
|
40
|
+
orientation?: string
|
|
41
|
+
background?: string
|
|
42
|
+
header?: boolean
|
|
43
|
+
footer?: boolean
|
|
44
|
+
showLineNumber?: boolean
|
|
45
|
+
showToc?: boolean
|
|
46
|
+
zoomLevel?: number
|
|
47
|
+
bodyHeight?: number
|
|
48
|
+
autoWidth?: boolean
|
|
49
|
+
preview?: {
|
|
50
|
+
enabled?: boolean
|
|
51
|
+
laserPointer?: boolean
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type ToolbarMenu =
|
|
56
|
+
| 'base'
|
|
57
|
+
| 'insert'
|
|
58
|
+
| 'table'
|
|
59
|
+
| 'tools'
|
|
60
|
+
| 'page'
|
|
61
|
+
| 'export'
|
|
62
|
+
| 'advanced'
|
|
63
|
+
| 'custom'
|
|
64
|
+
|
|
65
|
+
export interface ToolbarOptions {
|
|
66
|
+
defaultMode: 'classic' | 'ribbon'
|
|
67
|
+
enableSourceEditor: boolean
|
|
68
|
+
showToolbarMode: boolean
|
|
69
|
+
fromType: string
|
|
70
|
+
menus: ToolbarMenu[]
|
|
71
|
+
disableMenuItems: string[]
|
|
72
|
+
importWord: {
|
|
73
|
+
enabled: boolean
|
|
74
|
+
options: unknown
|
|
75
|
+
useCustomMethod?: boolean
|
|
76
|
+
onCustomImportWordMethod?: (file: File) => Promise<{
|
|
77
|
+
id: string
|
|
78
|
+
url: string
|
|
79
|
+
value: string
|
|
80
|
+
messages: { type: string; message: string }
|
|
81
|
+
}>
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface AutoSaveOptions {
|
|
86
|
+
enabled: boolean
|
|
87
|
+
interval: number
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface DocumentOptions {
|
|
91
|
+
id?: string
|
|
92
|
+
title: string
|
|
93
|
+
content: string
|
|
94
|
+
placeholder?: Record<string, string>
|
|
95
|
+
enableSpellcheck?: boolean
|
|
96
|
+
enableMarkdown?: boolean
|
|
97
|
+
enableBubbleMenu?: boolean
|
|
98
|
+
enableBlockMenu?: boolean
|
|
99
|
+
// enableComment?: boolean
|
|
100
|
+
readOnly?: boolean
|
|
101
|
+
autofocus?: 'start' | 'end' | 'all' | number | boolean | null
|
|
102
|
+
characterLimit?: number
|
|
103
|
+
typographyRules?: Record<string, unknown>
|
|
104
|
+
editorProps?: Record<string, unknown>
|
|
105
|
+
parseOptions?: Record<string, unknown>
|
|
106
|
+
autoSave?: AutoSaveOptions
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type LocaleLabel =
|
|
110
|
+
| string
|
|
111
|
+
| { en_US: string; zh_CN: string; ru_RU: string }
|
|
112
|
+
|
|
113
|
+
export interface PageSize {
|
|
114
|
+
label: LocaleLabel
|
|
115
|
+
width: number
|
|
116
|
+
height: number
|
|
117
|
+
default?: boolean
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface Font {
|
|
121
|
+
label: LocaleLabel
|
|
122
|
+
value: string | null
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface LineHeight {
|
|
126
|
+
label: LocaleLabel
|
|
127
|
+
value: number
|
|
128
|
+
default?: boolean
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface GraphicSymbol {
|
|
132
|
+
label: LocaleLabel
|
|
133
|
+
items: string
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface Emoji {
|
|
137
|
+
label: LocaleLabel
|
|
138
|
+
items: string
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface Template {
|
|
142
|
+
title: string
|
|
143
|
+
content: string
|
|
144
|
+
description?: string
|
|
145
|
+
value: string
|
|
146
|
+
divider?: boolean
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface AssistantOptions {
|
|
150
|
+
maxlength: number
|
|
151
|
+
commands: CommandItem[]
|
|
152
|
+
enabled: boolean
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface EchartsOptions {
|
|
156
|
+
isRelative: boolean
|
|
157
|
+
cdnUrl: string
|
|
158
|
+
filePath: string
|
|
159
|
+
mode: number
|
|
160
|
+
haveImage: boolean
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface UserItem {
|
|
164
|
+
id: string
|
|
165
|
+
name: string
|
|
166
|
+
avatar?: string
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface WebPageItem {
|
|
170
|
+
label: LocaleLabel
|
|
171
|
+
icon: string
|
|
172
|
+
validate(url: string): boolean
|
|
173
|
+
transformURL?(url: string): string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface CommandItem {
|
|
177
|
+
label: LocaleLabel
|
|
178
|
+
value: LocaleLabel
|
|
179
|
+
autoSend?: boolean
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface AssistantPayload {
|
|
183
|
+
lang: string
|
|
184
|
+
input: string
|
|
185
|
+
command: string
|
|
186
|
+
output: string
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface AssistantContent {
|
|
190
|
+
html: string
|
|
191
|
+
text: string
|
|
192
|
+
json: unknown
|
|
193
|
+
}
|
|
194
|
+
export interface AssistantResult {
|
|
195
|
+
prompt: string
|
|
196
|
+
content: string
|
|
197
|
+
error: boolean
|
|
198
|
+
command?: string
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface FileOptions {
|
|
202
|
+
allowedMimeTypes: string[]
|
|
203
|
+
maxSize: number
|
|
204
|
+
preview: {
|
|
205
|
+
extensions?: string[]
|
|
206
|
+
url: string
|
|
207
|
+
}[]
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface UmoEditorOptions {
|
|
211
|
+
editorKey: string
|
|
212
|
+
locale: SupportedLocale
|
|
213
|
+
theme: 'light' | 'dark'
|
|
214
|
+
height: string
|
|
215
|
+
fullscreenZIndex: number
|
|
216
|
+
dicts?: {
|
|
217
|
+
pageSizes: PageSize[]
|
|
218
|
+
fonts: Font[]
|
|
219
|
+
colors: string[]
|
|
220
|
+
lineHeights: LineHeight[]
|
|
221
|
+
symbols: GraphicSymbol[]
|
|
222
|
+
emojis: Emoji[]
|
|
223
|
+
}
|
|
224
|
+
toolbar?: ToolbarOptions
|
|
225
|
+
page: PageOption
|
|
226
|
+
document?: DocumentOptions
|
|
227
|
+
assistant?: AssistantOptions
|
|
228
|
+
echarts?: EchartsOptions
|
|
229
|
+
webPages?: WebPageItem[]
|
|
230
|
+
templates?: Template[]
|
|
231
|
+
cdnUrl?: string
|
|
232
|
+
baseUrl?: string
|
|
233
|
+
noReplaceImgUrl?: string
|
|
234
|
+
shareUrl?: string
|
|
235
|
+
diagrams?: Record<string, unknown>
|
|
236
|
+
mindmap?: Record<string, unknown>
|
|
237
|
+
plantuml?: Record<string, unknown>
|
|
238
|
+
file?: FileOptions
|
|
239
|
+
user?: Record<string, unknown>
|
|
240
|
+
users?: UserItem[]
|
|
241
|
+
extensions?: Extension[]
|
|
242
|
+
translations?: Record<string, unknown>
|
|
243
|
+
onSave?: AsyncFunction
|
|
244
|
+
onFileUpload?: (file: File) => Promise<{ id: string; url: string }>
|
|
245
|
+
onFileDelete?: CallableFunction
|
|
246
|
+
onCustomizeChartSettings?: CallableFunction
|
|
247
|
+
onAssistant?: AsyncFunction
|
|
248
|
+
onCustomImportWordMethod?: AsyncFunction
|
|
249
|
+
initFetchUsers?: AsyncFunction
|
|
250
|
+
fetchReplaceUrl?: AsyncFunction
|
|
251
|
+
}
|