md-editor-v3 1.7.1 → 1.9.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 +66 -2
- package/lib/MdEditor/Editor.d.ts +86 -3
- package/lib/md-editor-v3.es.js +2451 -2070
- package/lib/md-editor-v3.umd.js +77 -57
- package/lib/style.css +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
English \| [中文](https://github.com/imzbf/md-editor-v3/blob/dev/README-CN.md)
|
|
6
6
|
|
|
7
|
-
Markdown editor for vue3, developed
|
|
7
|
+
Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
8
8
|
|
|
9
9
|
- Documentation and demo:[Go](https://imzbf.github.io/md-editor-v3)
|
|
10
10
|
|
|
@@ -22,6 +22,8 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
22
22
|
- Upload picture, paste or clip the picture and upload it.
|
|
23
23
|
- Render article directly(no editor,no event listener, only preview content).
|
|
24
24
|
- Preview themes, support `defalut`、`vuepress`、`github` styles(not identical).
|
|
25
|
+
- `mermaid`(>=1.3.0).
|
|
26
|
+
- `katex` mathematical formula(>=1.9.0).
|
|
25
27
|
|
|
26
28
|
> More features are developing, if you have some ideas or find issues, please tell it to me~
|
|
27
29
|
|
|
@@ -29,7 +31,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
29
31
|
|
|
30
32
|
| Default theme | Dark theme | Preview only |
|
|
31
33
|
| --- | --- | --- |
|
|
32
|
-
|  |  |  |
|
|
33
35
|
|
|
34
36
|
## Apis
|
|
35
37
|
|
|
@@ -65,6 +67,15 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
65
67
|
| screenfullJs<sup><v1.4.3</sup> | String | [screenfull@5.1.0](https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js) | Screenfull js url |
|
|
66
68
|
| previewTheme<sup>v1.4.3</sup> | 'default' \| 'github' \| 'vuepress' | 'default' | Preview themes |
|
|
67
69
|
| style<sup>v1.7.0</sup> | CSSProperties | {} | Editor's inline style |
|
|
70
|
+
| tableShape<sup>v1.8.0</sup> | [Number, Number] | [6, 4] | Preset the size of the table, [columns, rows]. |
|
|
71
|
+
| mermaid<sup>v1.8.0</sup> | Object | undefined | `mermaid` instance |
|
|
72
|
+
| mermaidJs<sup>v1.8.0</sup> | String | [mermaid@8.13.5](https://cdn.jsdelivr.net/npm/mermaid@8.13.5/dist/mermaid.min.js) | mermaidJs url |
|
|
73
|
+
| noMermaid<sup>v1.8.0</sup> | Boolean | false | do not use mermaid |
|
|
74
|
+
| placeholder<sup>v1.8.0</sup> | String | '' | |
|
|
75
|
+
| katex<sup>v1.9.0</sup> | Object | undefined | `katex` instance(you need import css by yourself.) |
|
|
76
|
+
| katexJs<sup>v1.9.0</sup> | String | [katex.min.js@0.15.1](https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js) | katexJs url |
|
|
77
|
+
| katexCss<sup>v1.9.0</sup> | String | [katex.min.css@0.15.1](https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css) | katexCss url |
|
|
78
|
+
| noKatex<sup>v1.9.0</sup> | Boolean | false | do not use katex |
|
|
68
79
|
|
|
69
80
|
[toolbars]
|
|
70
81
|
|
|
@@ -87,6 +98,8 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
87
98
|
'link',
|
|
88
99
|
'image',
|
|
89
100
|
'table',
|
|
101
|
+
'mermaid',
|
|
102
|
+
'katex',
|
|
90
103
|
'-',
|
|
91
104
|
'revoke',
|
|
92
105
|
'next',
|
|
@@ -108,6 +121,38 @@ Expand language,you need to replace all the content here:
|
|
|
108
121
|
[StaticTextDefaultValue]
|
|
109
122
|
|
|
110
123
|
```ts
|
|
124
|
+
export interface ToolbarTips {
|
|
125
|
+
bold?: string;
|
|
126
|
+
underline?: string;
|
|
127
|
+
italic?: string;
|
|
128
|
+
strikeThrough?: string;
|
|
129
|
+
title?: string;
|
|
130
|
+
sub?: string;
|
|
131
|
+
sup?: string;
|
|
132
|
+
quote?: string;
|
|
133
|
+
unorderedList?: string;
|
|
134
|
+
orderedList?: string;
|
|
135
|
+
codeRow?: string;
|
|
136
|
+
code?: string;
|
|
137
|
+
link?: string;
|
|
138
|
+
image?: string;
|
|
139
|
+
table?: string;
|
|
140
|
+
mermaid?: string;
|
|
141
|
+
katex?: string;
|
|
142
|
+
revoke?: string;
|
|
143
|
+
next?: string;
|
|
144
|
+
save?: string;
|
|
145
|
+
prettier?: string;
|
|
146
|
+
pageFullscreen?: string;
|
|
147
|
+
fullscreen?: string;
|
|
148
|
+
catalog?: string;
|
|
149
|
+
preview?: string;
|
|
150
|
+
htmlPreview?: string;
|
|
151
|
+
github?: string;
|
|
152
|
+
'-'?: string;
|
|
153
|
+
'='?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
111
156
|
export interface StaticTextDefaultValue {
|
|
112
157
|
// Toolbar hover tips(html title)
|
|
113
158
|
toolbarTips?: ToolbarTips;
|
|
@@ -145,6 +190,24 @@ export interface StaticTextDefaultValue {
|
|
|
145
190
|
text?: string;
|
|
146
191
|
tips?: string;
|
|
147
192
|
};
|
|
193
|
+
// 1.8.0
|
|
194
|
+
mermaid?: {
|
|
195
|
+
flow?: string;
|
|
196
|
+
sequence?: string;
|
|
197
|
+
gantt?: string;
|
|
198
|
+
class?: string;
|
|
199
|
+
state?: string;
|
|
200
|
+
pie?: string;
|
|
201
|
+
relationship?: string;
|
|
202
|
+
journey?: string;
|
|
203
|
+
};
|
|
204
|
+
// 1.9.0
|
|
205
|
+
katex?: {
|
|
206
|
+
// formula inline
|
|
207
|
+
inline: string;
|
|
208
|
+
// formula block
|
|
209
|
+
block: string;
|
|
210
|
+
};
|
|
148
211
|
}
|
|
149
212
|
```
|
|
150
213
|
|
|
@@ -159,6 +222,7 @@ export interface StaticTextDefaultValue {
|
|
|
159
222
|
| onGetCatalog<sup>v1.4.0</sup> | list: HeadList[] | Get catalogue of article |
|
|
160
223
|
| markedHeading<sup>v1.6.0</sup> | text: string,level: 1-6,raw: string, slugger: Slugger | `marked` head renderer methods |
|
|
161
224
|
| markedHeadingId<sup>v1.7.0</sup> | (text: string, level: number) => string | title `ID` generator |
|
|
225
|
+
| sanitize | (html: string) => string | Sanitize the html, prevent XSS. |
|
|
162
226
|
|
|
163
227
|
> If `markedHeading` is overridden, be sure to tell the editor the algorithm for generating the title ID by `marketheadingid`.
|
|
164
228
|
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
prettierPlugins: any;
|
|
7
7
|
Cropper: any;
|
|
8
8
|
screenfull: any;
|
|
9
|
+
mermaid: any;
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
export interface ToolbarTips {
|
|
@@ -24,6 +25,8 @@ export interface ToolbarTips {
|
|
|
24
25
|
link?: string;
|
|
25
26
|
image?: string;
|
|
26
27
|
table?: string;
|
|
28
|
+
mermaid?: string;
|
|
29
|
+
katex?: string;
|
|
27
30
|
revoke?: string;
|
|
28
31
|
next?: string;
|
|
29
32
|
save?: string;
|
|
@@ -68,6 +71,20 @@ export interface StaticTextDefaultValue {
|
|
|
68
71
|
text?: string;
|
|
69
72
|
tips?: string;
|
|
70
73
|
};
|
|
74
|
+
mermaid?: {
|
|
75
|
+
flow?: string;
|
|
76
|
+
sequence?: string;
|
|
77
|
+
gantt?: string;
|
|
78
|
+
class?: string;
|
|
79
|
+
state?: string;
|
|
80
|
+
pie?: string;
|
|
81
|
+
relationship?: string;
|
|
82
|
+
journey?: string;
|
|
83
|
+
};
|
|
84
|
+
katex?: {
|
|
85
|
+
inline: string;
|
|
86
|
+
block: string;
|
|
87
|
+
};
|
|
71
88
|
}
|
|
72
89
|
export interface StaticTextDefault {
|
|
73
90
|
'zh-CN': StaticTextDefaultValue;
|
|
@@ -228,7 +245,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
228
245
|
};
|
|
229
246
|
markedHeading: {
|
|
230
247
|
type: PropType<MarkedHeading>;
|
|
231
|
-
default: (text: string, level: number) => string;
|
|
248
|
+
default: (text: string, level: number, raw: string) => string;
|
|
232
249
|
};
|
|
233
250
|
style: {
|
|
234
251
|
type: PropType<string | CSSProperties>;
|
|
@@ -238,6 +255,44 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
238
255
|
type: PropType<MarkedHeadingId>;
|
|
239
256
|
default: MarkedHeadingId;
|
|
240
257
|
};
|
|
258
|
+
tableShape: {
|
|
259
|
+
type: PropType<number[]>;
|
|
260
|
+
default: () => number[];
|
|
261
|
+
};
|
|
262
|
+
mermaid: {
|
|
263
|
+
type: ObjectConstructor;
|
|
264
|
+
};
|
|
265
|
+
mermaidJs: {
|
|
266
|
+
type: PropType<string>;
|
|
267
|
+
default: string;
|
|
268
|
+
};
|
|
269
|
+
noMermaid: {
|
|
270
|
+
type: PropType<boolean>;
|
|
271
|
+
default: boolean;
|
|
272
|
+
};
|
|
273
|
+
sanitize: {
|
|
274
|
+
type: PropType<(html: string) => string>;
|
|
275
|
+
default: (html: string) => string;
|
|
276
|
+
};
|
|
277
|
+
placeholder: {
|
|
278
|
+
type: PropType<string>;
|
|
279
|
+
default: string;
|
|
280
|
+
};
|
|
281
|
+
katex: {
|
|
282
|
+
type: ObjectConstructor;
|
|
283
|
+
};
|
|
284
|
+
katexJs: {
|
|
285
|
+
type: PropType<string>;
|
|
286
|
+
default: string;
|
|
287
|
+
};
|
|
288
|
+
katexCss: {
|
|
289
|
+
type: PropType<string>;
|
|
290
|
+
default: string;
|
|
291
|
+
};
|
|
292
|
+
noKatex: {
|
|
293
|
+
type: PropType<boolean>;
|
|
294
|
+
default: boolean;
|
|
295
|
+
};
|
|
241
296
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
242
297
|
modelValue?: unknown;
|
|
243
298
|
theme?: unknown;
|
|
@@ -275,6 +330,16 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
275
330
|
markedHeading?: unknown;
|
|
276
331
|
style?: unknown;
|
|
277
332
|
markedHeadingId?: unknown;
|
|
333
|
+
tableShape?: unknown;
|
|
334
|
+
mermaid?: unknown;
|
|
335
|
+
mermaidJs?: unknown;
|
|
336
|
+
noMermaid?: unknown;
|
|
337
|
+
sanitize?: unknown;
|
|
338
|
+
placeholder?: unknown;
|
|
339
|
+
katex?: unknown;
|
|
340
|
+
katexJs?: unknown;
|
|
341
|
+
katexCss?: unknown;
|
|
342
|
+
noKatex?: unknown;
|
|
278
343
|
} & {
|
|
279
344
|
editorId: string;
|
|
280
345
|
prettier: boolean;
|
|
@@ -284,11 +349,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
284
349
|
tabWidth: number;
|
|
285
350
|
showCodeRowNumber: boolean;
|
|
286
351
|
Cropper: Function;
|
|
352
|
+
theme: "dark" | "light";
|
|
287
353
|
historyLength: number;
|
|
288
354
|
previewTheme: PreviewThemes;
|
|
289
355
|
style: string | CSSProperties;
|
|
290
356
|
modelValue: string;
|
|
291
|
-
theme: "dark" | "light";
|
|
292
357
|
editorClass: string;
|
|
293
358
|
hljs: Record<string, any>;
|
|
294
359
|
highlightJs: string;
|
|
@@ -309,7 +374,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
309
374
|
screenfullJs: string;
|
|
310
375
|
markedHeading: MarkedHeading;
|
|
311
376
|
markedHeadingId: MarkedHeadingId;
|
|
377
|
+
tableShape: number[];
|
|
378
|
+
mermaidJs: string;
|
|
379
|
+
noMermaid: boolean;
|
|
380
|
+
sanitize: (html: string) => string;
|
|
381
|
+
placeholder: string;
|
|
382
|
+
katexJs: string;
|
|
383
|
+
katexCss: string;
|
|
384
|
+
noKatex: boolean;
|
|
312
385
|
} & {
|
|
386
|
+
mermaid?: Record<string, any> | undefined;
|
|
387
|
+
katex?: Record<string, any> | undefined;
|
|
313
388
|
onSave?: ((v: string) => void) | undefined;
|
|
314
389
|
onChange?: ((v: string) => void) | undefined;
|
|
315
390
|
onUploadImg?: ((files: FileList, callBack: (urls: string[]) => void) => void) | undefined;
|
|
@@ -324,11 +399,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
324
399
|
tabWidth: number;
|
|
325
400
|
showCodeRowNumber: boolean;
|
|
326
401
|
Cropper: Function;
|
|
402
|
+
theme: "dark" | "light";
|
|
327
403
|
historyLength: number;
|
|
328
404
|
previewTheme: PreviewThemes;
|
|
329
405
|
style: string | CSSProperties;
|
|
330
406
|
modelValue: string;
|
|
331
|
-
theme: "dark" | "light";
|
|
332
407
|
editorClass: string;
|
|
333
408
|
hljs: Record<string, any>;
|
|
334
409
|
highlightJs: string;
|
|
@@ -349,5 +424,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
349
424
|
screenfullJs: string;
|
|
350
425
|
markedHeading: MarkedHeading;
|
|
351
426
|
markedHeadingId: MarkedHeadingId;
|
|
427
|
+
tableShape: number[];
|
|
428
|
+
mermaidJs: string;
|
|
429
|
+
noMermaid: boolean;
|
|
430
|
+
sanitize: (html: string) => string;
|
|
431
|
+
placeholder: string;
|
|
432
|
+
katexJs: string;
|
|
433
|
+
katexCss: string;
|
|
434
|
+
noKatex: boolean;
|
|
352
435
|
}>;
|
|
353
436
|
export default _default;
|