md-editor-v3 2.0.0 → 2.1.0-beta.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/LICENSE +1 -1
- package/README.md +10 -8
- package/lib/MdEditor/Editor.d.ts +29 -5
- package/lib/MdEditor/extensions/MdCatalog/index.d.ts +1 -0
- package/lib/MdEditor/index.d.ts +61 -11
- package/lib/MdEditor/type.d.ts +6 -1
- package/lib/md-editor-v3.es.js +288 -103
- package/lib/md-editor-v3.umd.js +55 -55
- package/lib/style.css +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -247,12 +247,12 @@ const handler = () => {
|
|
|
247
247
|
|
|
248
248
|
| name | param | description |
|
|
249
249
|
| --- | --- | --- |
|
|
250
|
-
| onChange |
|
|
251
|
-
| onSave |
|
|
252
|
-
| onUploadImg | files:Array<File>, callback:
|
|
253
|
-
| onHtmlChanged |
|
|
254
|
-
| onGetCatalog | list: HeadList
|
|
255
|
-
| onError | err: { name: string; message: string } | Catch run-time error, `Cropper
|
|
250
|
+
| onChange | `value: string` | Content changed event(bind to `oninput` of `textarea`) |
|
|
251
|
+
| onSave | `value: string` | Save content event, `ctrl+s`and click button will be triggered also |
|
|
252
|
+
| onUploadImg | `files: Array<File>, callback: (urls: Array<string>) => void` | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
|
|
253
|
+
| onHtmlChanged | `html: string` | Compile markdown successful event, you can use it to get the html code |
|
|
254
|
+
| onGetCatalog | `list: Array<HeadList>` | Get catalog of article |
|
|
255
|
+
| onError | `err: { name: string; message: string }` | Catch run-time error, `Cropper`, `fullScreen` and `prettier` are used when they are not loaded |
|
|
256
256
|
|
|
257
257
|
## Config
|
|
258
258
|
|
|
@@ -398,7 +398,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
398
398
|
| CTRL + SHIFT + S | line-through | `~line-through~` |
|
|
399
399
|
| CTRL + SHIFT + U | unordered list | `- unordered list` |
|
|
400
400
|
| CTRL + SHIFT + C | code block | |
|
|
401
|
-
| CTRL + SHIFT + I | picture | `` |
|
|
402
402
|
| CTRL + SHIFT + Z | forward | Forward history in editor, not the function of system |
|
|
403
403
|
| CTRL + SHIFT + F | Beautify | |
|
|
404
404
|
| CTRL + ALT + C | code row | |
|
|
@@ -516,10 +516,11 @@ const text = ref('# Hello Editor');
|
|
|
516
516
|
</script>
|
|
517
517
|
```
|
|
518
518
|
|
|
519
|
-
### Upload
|
|
519
|
+
### Upload Picture
|
|
520
520
|
|
|
521
521
|
> Tips: When you paste and upload GIF, it will upload a static picture. So you should upload it by file system!
|
|
522
522
|
|
|
523
|
+
```vue
|
|
523
524
|
<template>
|
|
524
525
|
<md-editor v-model="text" @onUploadImg="onUploadImg" />
|
|
525
526
|
</template>
|
|
@@ -553,6 +554,7 @@ const onUploadImg = async (files, callback) => {
|
|
|
553
554
|
callback(res.map((item) => item.data.url));
|
|
554
555
|
};
|
|
555
556
|
</script>
|
|
557
|
+
```
|
|
556
558
|
|
|
557
559
|
### Change Styles
|
|
558
560
|
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropType, CSSProperties } from 'vue';
|
|
2
|
-
import { ToolbarNames, HeadList, MarkedHeadingId, Themes, InnerError } from './type';
|
|
2
|
+
import { ToolbarNames, HeadList, MarkedHeadingId, Themes, InnerError, Footers } from './type';
|
|
3
3
|
export declare const markedHeadingId: MarkedHeadingId;
|
|
4
4
|
declare const Editor: import("vue").DefineComponent<{
|
|
5
5
|
modelValue: {
|
|
@@ -119,7 +119,18 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
119
119
|
type: PropType<string>;
|
|
120
120
|
default: string;
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
footers: {
|
|
123
|
+
type: PropType<Footers[]>;
|
|
124
|
+
default: Footers[];
|
|
125
|
+
};
|
|
126
|
+
scrollAuto: {
|
|
127
|
+
type: PropType<boolean>;
|
|
128
|
+
default: boolean;
|
|
129
|
+
};
|
|
130
|
+
defFooters: {
|
|
131
|
+
type: PropType<string | JSX.Element>;
|
|
132
|
+
};
|
|
133
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
123
134
|
modelValue: {
|
|
124
135
|
type: PropType<string>;
|
|
125
136
|
default: string;
|
|
@@ -237,21 +248,33 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
237
248
|
type: PropType<string>;
|
|
238
249
|
default: string;
|
|
239
250
|
};
|
|
251
|
+
footers: {
|
|
252
|
+
type: PropType<Footers[]>;
|
|
253
|
+
default: Footers[];
|
|
254
|
+
};
|
|
255
|
+
scrollAuto: {
|
|
256
|
+
type: PropType<boolean>;
|
|
257
|
+
default: boolean;
|
|
258
|
+
};
|
|
259
|
+
defFooters: {
|
|
260
|
+
type: PropType<string | JSX.Element>;
|
|
261
|
+
};
|
|
240
262
|
}>>, {
|
|
241
|
-
|
|
263
|
+
pageFullScreen: boolean;
|
|
242
264
|
preview: boolean;
|
|
243
265
|
htmlPreview: boolean;
|
|
266
|
+
editorId: string;
|
|
267
|
+
noPrettier: boolean;
|
|
244
268
|
tabWidth: number;
|
|
245
269
|
theme: Themes;
|
|
246
270
|
historyLength: number;
|
|
247
271
|
previewOnly: boolean;
|
|
248
272
|
showCodeRowNumber: boolean;
|
|
249
273
|
previewTheme: string;
|
|
250
|
-
noPrettier: boolean;
|
|
251
274
|
style: string | CSSProperties;
|
|
252
275
|
class: string;
|
|
276
|
+
scrollAuto: boolean;
|
|
253
277
|
modelValue: string;
|
|
254
|
-
pageFullScreen: boolean;
|
|
255
278
|
language: string;
|
|
256
279
|
toolbars: ToolbarNames[];
|
|
257
280
|
toolbarsExclude: ToolbarNames[];
|
|
@@ -262,5 +285,6 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
262
285
|
placeholder: string;
|
|
263
286
|
noKatex: boolean;
|
|
264
287
|
codeTheme: string;
|
|
288
|
+
footers: Footers[];
|
|
265
289
|
}>;
|
|
266
290
|
export default Editor;
|
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -9,20 +9,21 @@ declare const _default: {
|
|
|
9
9
|
$: import("vue").ComponentInternalInstance;
|
|
10
10
|
$data: {};
|
|
11
11
|
$props: Partial<{
|
|
12
|
-
|
|
12
|
+
pageFullScreen: boolean;
|
|
13
13
|
preview: boolean;
|
|
14
14
|
htmlPreview: boolean;
|
|
15
|
+
editorId: string;
|
|
16
|
+
noPrettier: boolean;
|
|
15
17
|
tabWidth: number;
|
|
16
18
|
theme: import("./type").Themes;
|
|
17
19
|
historyLength: number;
|
|
18
20
|
previewOnly: boolean;
|
|
19
21
|
showCodeRowNumber: boolean;
|
|
20
22
|
previewTheme: string;
|
|
21
|
-
noPrettier: boolean;
|
|
22
23
|
style: string | import("vue").CSSProperties;
|
|
23
24
|
class: string;
|
|
25
|
+
scrollAuto: boolean;
|
|
24
26
|
modelValue: string;
|
|
25
|
-
pageFullScreen: boolean;
|
|
26
27
|
language: string;
|
|
27
28
|
toolbars: import("./type").ToolbarNames[];
|
|
28
29
|
toolbarsExclude: import("./type").ToolbarNames[];
|
|
@@ -33,6 +34,7 @@ declare const _default: {
|
|
|
33
34
|
placeholder: string;
|
|
34
35
|
noKatex: boolean;
|
|
35
36
|
codeTheme: string;
|
|
37
|
+
footers: import("./type").Footers[];
|
|
36
38
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
37
39
|
modelValue: {
|
|
38
40
|
type: import("vue").PropType<string>;
|
|
@@ -151,7 +153,18 @@ declare const _default: {
|
|
|
151
153
|
type: import("vue").PropType<string>;
|
|
152
154
|
default: string;
|
|
153
155
|
};
|
|
154
|
-
|
|
156
|
+
footers: {
|
|
157
|
+
type: import("vue").PropType<import("./type").Footers[]>;
|
|
158
|
+
default: import("./type").Footers[];
|
|
159
|
+
};
|
|
160
|
+
scrollAuto: {
|
|
161
|
+
type: import("vue").PropType<boolean>;
|
|
162
|
+
default: boolean;
|
|
163
|
+
};
|
|
164
|
+
defFooters: {
|
|
165
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
166
|
+
};
|
|
167
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullScreen" | "preview" | "htmlPreview" | "editorId" | "noPrettier" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "style" | "class" | "scrollAuto" | "modelValue" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme" | "footers">;
|
|
155
168
|
$attrs: {
|
|
156
169
|
[x: string]: unknown;
|
|
157
170
|
};
|
|
@@ -283,21 +296,33 @@ declare const _default: {
|
|
|
283
296
|
type: import("vue").PropType<string>;
|
|
284
297
|
default: string;
|
|
285
298
|
};
|
|
299
|
+
footers: {
|
|
300
|
+
type: import("vue").PropType<import("./type").Footers[]>;
|
|
301
|
+
default: import("./type").Footers[];
|
|
302
|
+
};
|
|
303
|
+
scrollAuto: {
|
|
304
|
+
type: import("vue").PropType<boolean>;
|
|
305
|
+
default: boolean;
|
|
306
|
+
};
|
|
307
|
+
defFooters: {
|
|
308
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
309
|
+
};
|
|
286
310
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
|
|
287
|
-
|
|
311
|
+
pageFullScreen: boolean;
|
|
288
312
|
preview: boolean;
|
|
289
313
|
htmlPreview: boolean;
|
|
314
|
+
editorId: string;
|
|
315
|
+
noPrettier: boolean;
|
|
290
316
|
tabWidth: number;
|
|
291
317
|
theme: import("./type").Themes;
|
|
292
318
|
historyLength: number;
|
|
293
319
|
previewOnly: boolean;
|
|
294
320
|
showCodeRowNumber: boolean;
|
|
295
321
|
previewTheme: string;
|
|
296
|
-
noPrettier: boolean;
|
|
297
322
|
style: string | import("vue").CSSProperties;
|
|
298
323
|
class: string;
|
|
324
|
+
scrollAuto: boolean;
|
|
299
325
|
modelValue: string;
|
|
300
|
-
pageFullScreen: boolean;
|
|
301
326
|
language: string;
|
|
302
327
|
toolbars: import("./type").ToolbarNames[];
|
|
303
328
|
toolbarsExclude: import("./type").ToolbarNames[];
|
|
@@ -308,6 +333,7 @@ declare const _default: {
|
|
|
308
333
|
placeholder: string;
|
|
309
334
|
noKatex: boolean;
|
|
310
335
|
codeTheme: string;
|
|
336
|
+
footers: import("./type").Footers[];
|
|
311
337
|
}> & {
|
|
312
338
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
313
339
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -446,6 +472,17 @@ declare const _default: {
|
|
|
446
472
|
type: import("vue").PropType<string>;
|
|
447
473
|
default: string;
|
|
448
474
|
};
|
|
475
|
+
footers: {
|
|
476
|
+
type: import("vue").PropType<import("./type").Footers[]>;
|
|
477
|
+
default: import("./type").Footers[];
|
|
478
|
+
};
|
|
479
|
+
scrollAuto: {
|
|
480
|
+
type: import("vue").PropType<boolean>;
|
|
481
|
+
default: boolean;
|
|
482
|
+
};
|
|
483
|
+
defFooters: {
|
|
484
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
485
|
+
};
|
|
449
486
|
}>> & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
|
|
450
487
|
__isFragment?: undefined;
|
|
451
488
|
__isTeleport?: undefined;
|
|
@@ -568,21 +605,33 @@ declare const _default: {
|
|
|
568
605
|
type: import("vue").PropType<string>;
|
|
569
606
|
default: string;
|
|
570
607
|
};
|
|
571
|
-
|
|
572
|
-
|
|
608
|
+
footers: {
|
|
609
|
+
type: import("vue").PropType<import("./type").Footers[]>;
|
|
610
|
+
default: import("./type").Footers[];
|
|
611
|
+
};
|
|
612
|
+
scrollAuto: {
|
|
613
|
+
type: import("vue").PropType<boolean>;
|
|
614
|
+
default: boolean;
|
|
615
|
+
};
|
|
616
|
+
defFooters: {
|
|
617
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
618
|
+
};
|
|
619
|
+
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", {
|
|
620
|
+
pageFullScreen: boolean;
|
|
573
621
|
preview: boolean;
|
|
574
622
|
htmlPreview: boolean;
|
|
623
|
+
editorId: string;
|
|
624
|
+
noPrettier: boolean;
|
|
575
625
|
tabWidth: number;
|
|
576
626
|
theme: import("./type").Themes;
|
|
577
627
|
historyLength: number;
|
|
578
628
|
previewOnly: boolean;
|
|
579
629
|
showCodeRowNumber: boolean;
|
|
580
630
|
previewTheme: string;
|
|
581
|
-
noPrettier: boolean;
|
|
582
631
|
style: string | import("vue").CSSProperties;
|
|
583
632
|
class: string;
|
|
633
|
+
scrollAuto: boolean;
|
|
584
634
|
modelValue: string;
|
|
585
|
-
pageFullScreen: boolean;
|
|
586
635
|
language: string;
|
|
587
636
|
toolbars: import("./type").ToolbarNames[];
|
|
588
637
|
toolbarsExclude: import("./type").ToolbarNames[];
|
|
@@ -593,6 +642,7 @@ declare const _default: {
|
|
|
593
642
|
placeholder: string;
|
|
594
643
|
noKatex: boolean;
|
|
595
644
|
codeTheme: string;
|
|
645
|
+
footers: import("./type").Footers[];
|
|
596
646
|
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
597
647
|
readonly NormalToolbar: typeof NormalToolbar;
|
|
598
648
|
readonly DropdownToolbar: typeof DropdownToolbar;
|
package/lib/MdEditor/type.d.ts
CHANGED
|
@@ -87,6 +87,10 @@ export interface StaticTextDefaultValue {
|
|
|
87
87
|
inline: string;
|
|
88
88
|
block: string;
|
|
89
89
|
};
|
|
90
|
+
footer?: {
|
|
91
|
+
markdownTotal: string;
|
|
92
|
+
scrollAuto: string;
|
|
93
|
+
};
|
|
90
94
|
}
|
|
91
95
|
export interface StaticTextDefault {
|
|
92
96
|
'zh-CN': StaticTextDefaultValue;
|
|
@@ -94,6 +98,7 @@ export interface StaticTextDefault {
|
|
|
94
98
|
}
|
|
95
99
|
export declare type StaticTextDefaultKey = keyof StaticTextDefault;
|
|
96
100
|
export declare type ToolbarNames = keyof ToolbarTips | number;
|
|
101
|
+
export declare type Footers = '=' | 'mardownTotal' | 'scrollSwitch' | number;
|
|
97
102
|
export interface SettingType {
|
|
98
103
|
pageFullScreen: boolean;
|
|
99
104
|
fullscreen: boolean;
|
|
@@ -106,7 +111,7 @@ export interface HeadList {
|
|
|
106
111
|
text: string;
|
|
107
112
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
108
113
|
}
|
|
109
|
-
export declare type MarkedHeadingId = (text: string, level: number) => string;
|
|
114
|
+
export declare type MarkedHeadingId = (text: string, level: number, index: number) => string;
|
|
110
115
|
export interface MermaidTemplate {
|
|
111
116
|
/**
|
|
112
117
|
* 流程图
|