md-editor-v3 2.5.0-beta.1 → 2.6.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/README.md +17 -3
- package/lib/MdEditor/Editor.d.ts +30 -0
- package/lib/MdEditor/config.d.ts +1 -1
- package/lib/MdEditor/extensions/MdCatalog/CatalogLink.d.ts +13 -0
- package/lib/MdEditor/extensions/MdCatalog/index.d.ts +47 -0
- package/lib/MdEditor/index.d.ts +75 -0
- package/lib/MdEditor/type.d.ts +9 -0
- package/lib/md-editor-v3.es.js +114 -32
- package/lib/md-editor-v3.umd.js +29 -26
- package/lib/style.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
    
|
|
4
4
|
|
|
5
|
-
English \| [中文](https://github.com/imzbf/md-editor-v3/blob/
|
|
5
|
+
English \| [中文](https://github.com/imzbf/md-editor-v3/blob/develop/README-CN.md)
|
|
6
6
|
|
|
7
7
|
Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
8
8
|
|
|
@@ -106,8 +106,13 @@ mark and emoji extensions
|
|
|
106
106
|
| noIconfont | `boolean` | false | Not append iconfont script, [download](https://at.alicdn.com/t/c/font_2605852_gymddm8qwtd.js) and import it by yourself |
|
|
107
107
|
| formatCopiedText | `(text: string) => string` | (text: string) => text | Format copied code |
|
|
108
108
|
| noUploadImg | `boolean` | false | Not show the entrance to upload pictures |
|
|
109
|
-
| codeStyleReverse | `boolean` |
|
|
109
|
+
| codeStyleReverse | `boolean` | true | Code style will be reversed to dark while code block of the theme has a dark background |
|
|
110
110
|
| codeStyleReverseList | `Array<string>` | ['default', 'mk-cute'] | Themes to be reversed |
|
|
111
|
+
| autoFocus | `boolean` | false | same as `autofocus` in native textarea |
|
|
112
|
+
| disabled | `boolean` | false | same as `disabled` in native textarea |
|
|
113
|
+
| readOnly | `boolean` | false | same as `readonly` in native textarea |
|
|
114
|
+
| maxLength | `number` | | same as `maxlength` in native textarea |
|
|
115
|
+
| autoDetectCode | `boolean` | false | auto detect the type of pasted code, only support that copied from `vscode` |
|
|
111
116
|
|
|
112
117
|
<details>
|
|
113
118
|
<summary>『toolbars』</summary>
|
|
@@ -389,6 +394,14 @@ editorRef.value?.insert((selectedText) => {
|
|
|
389
394
|
|
|
390
395
|
For more examples, refer to source code of [extension component](https://github.com/imzbf/md-editor-v3/blob/dev-docs/src/components/MarkExtension/index.vue)
|
|
391
396
|
|
|
397
|
+
### 🎯 focus
|
|
398
|
+
|
|
399
|
+
focus the textarea.
|
|
400
|
+
|
|
401
|
+
```js
|
|
402
|
+
editorRef.value?.focus();
|
|
403
|
+
```
|
|
404
|
+
|
|
392
405
|
### 🎍 Slots
|
|
393
406
|
|
|
394
407
|
| name | type | default | description |
|
|
@@ -435,7 +448,7 @@ const handler = () => {
|
|
|
435
448
|
| onGetCatalog | `list: Array<HeadList>` | Get catalog of article |
|
|
436
449
|
| onError | `err: { name: string; message: string }` | Catch run-time error, `Cropper`, `fullscreen` and `prettier` are used when they are not loaded |
|
|
437
450
|
|
|
438
|
-
## 💴 Config
|
|
451
|
+
## 💴 Config Editor
|
|
439
452
|
|
|
440
453
|
Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
441
454
|
|
|
@@ -660,6 +673,7 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
660
673
|
- `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
|
|
661
674
|
- `theme`: `'light' | 'dark'`, not necessary, provide it when you want to change theme online, it is the same as Editor `theme`.
|
|
662
675
|
- `offsetTop`: `number`, not necessary, highlight current item of catalogs when title is `offsetTop` pixels from the top, defalut 20.
|
|
676
|
+
- `scrollElementOffsetTop`: `number`, not necessary, offsetTop of the scroll container,defalut 0.
|
|
663
677
|
|
|
664
678
|
- **events**
|
|
665
679
|
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -145,6 +145,21 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
145
145
|
type: import("vue").PropType<string[]>;
|
|
146
146
|
default: string[];
|
|
147
147
|
};
|
|
148
|
+
autoFocus: {
|
|
149
|
+
type: import("vue").PropType<boolean>;
|
|
150
|
+
};
|
|
151
|
+
disabled: {
|
|
152
|
+
type: import("vue").PropType<boolean>;
|
|
153
|
+
};
|
|
154
|
+
readOnly: {
|
|
155
|
+
type: import("vue").PropType<boolean>;
|
|
156
|
+
};
|
|
157
|
+
maxLength: {
|
|
158
|
+
type: import("vue").PropType<number>;
|
|
159
|
+
};
|
|
160
|
+
autoDetectCode: {
|
|
161
|
+
type: import("vue").PropType<boolean>;
|
|
162
|
+
};
|
|
148
163
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
149
164
|
modelValue: {
|
|
150
165
|
type: import("vue").PropType<string>;
|
|
@@ -292,6 +307,21 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
292
307
|
type: import("vue").PropType<string[]>;
|
|
293
308
|
default: string[];
|
|
294
309
|
};
|
|
310
|
+
autoFocus: {
|
|
311
|
+
type: import("vue").PropType<boolean>;
|
|
312
|
+
};
|
|
313
|
+
disabled: {
|
|
314
|
+
type: import("vue").PropType<boolean>;
|
|
315
|
+
};
|
|
316
|
+
readOnly: {
|
|
317
|
+
type: import("vue").PropType<boolean>;
|
|
318
|
+
};
|
|
319
|
+
maxLength: {
|
|
320
|
+
type: import("vue").PropType<number>;
|
|
321
|
+
};
|
|
322
|
+
autoDetectCode: {
|
|
323
|
+
type: import("vue").PropType<boolean>;
|
|
324
|
+
};
|
|
295
325
|
}>>, {
|
|
296
326
|
pageFullscreen: boolean;
|
|
297
327
|
preview: boolean;
|
package/lib/MdEditor/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodeCss, Config, ConfigOption, Footers, StaticTextDefault } from './type';
|
|
2
2
|
export declare const prefix = "md-editor";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const defaultEditorId = "md-editor-v3";
|
|
4
4
|
export declare const iconfontUrl = "https://at.alicdn.com/t/c/font_2605852_gymddm8qwtd.js";
|
|
5
5
|
export declare const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
6
6
|
export declare const highlightUrl: string;
|
|
@@ -19,6 +19,10 @@ declare const catalogLinkProps: () => {
|
|
|
19
19
|
type: PropType<(e: MouseEvent, t: TocItem) => void>;
|
|
20
20
|
default: () => () => void;
|
|
21
21
|
};
|
|
22
|
+
scrollElementOffsetTop: {
|
|
23
|
+
type: PropType<number>;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
export declare type CatalogLinkProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<ReturnType<typeof catalogLinkProps>>>>>;
|
|
24
28
|
declare const CatalogLink: import("vue").DefineComponent<{
|
|
@@ -38,6 +42,10 @@ declare const CatalogLink: import("vue").DefineComponent<{
|
|
|
38
42
|
type: PropType<(e: MouseEvent, t: TocItem) => void>;
|
|
39
43
|
default: () => () => void;
|
|
40
44
|
};
|
|
45
|
+
scrollElementOffsetTop: {
|
|
46
|
+
type: PropType<number>;
|
|
47
|
+
default: number;
|
|
48
|
+
};
|
|
41
49
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
42
50
|
tocItem: {
|
|
43
51
|
type: PropType<TocItem>;
|
|
@@ -55,10 +63,15 @@ declare const CatalogLink: import("vue").DefineComponent<{
|
|
|
55
63
|
type: PropType<(e: MouseEvent, t: TocItem) => void>;
|
|
56
64
|
default: () => () => void;
|
|
57
65
|
};
|
|
66
|
+
scrollElementOffsetTop: {
|
|
67
|
+
type: PropType<number>;
|
|
68
|
+
default: number;
|
|
69
|
+
};
|
|
58
70
|
}>>, {
|
|
59
71
|
markedHeadingId: MarkedHeadingId;
|
|
60
72
|
onClick: (e: MouseEvent, t: TocItem) => void;
|
|
61
73
|
scrollElement: string | Element;
|
|
74
|
+
scrollElementOffsetTop: number;
|
|
62
75
|
tocItem: TocItem;
|
|
63
76
|
}>;
|
|
64
77
|
export default CatalogLink;
|
|
@@ -8,6 +8,9 @@ export interface TocItem {
|
|
|
8
8
|
children?: Array<TocItem>;
|
|
9
9
|
}
|
|
10
10
|
declare const MdCatalog: import("vue").DefineComponent<{
|
|
11
|
+
/**
|
|
12
|
+
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
13
|
+
*/
|
|
11
14
|
editorId: {
|
|
12
15
|
type: PropType<string>;
|
|
13
16
|
};
|
|
@@ -19,6 +22,12 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
19
22
|
type: PropType<MarkedHeadingId>;
|
|
20
23
|
default: (text: string) => string;
|
|
21
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* 指定滚动的容器,选择器需带上对应的符号,默认预览框
|
|
27
|
+
* 元素必须定位!!!!!!
|
|
28
|
+
*
|
|
29
|
+
* 默认:#md-editor-preview-wrapper
|
|
30
|
+
*/
|
|
22
31
|
scrollElement: {
|
|
23
32
|
type: PropType<string | HTMLElement>;
|
|
24
33
|
};
|
|
@@ -26,11 +35,28 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
26
35
|
type: PropType<Themes>;
|
|
27
36
|
default: string;
|
|
28
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* 高亮标题相对滚动容器顶部偏移量,即距离该值时,高亮当前目录菜单项
|
|
40
|
+
*
|
|
41
|
+
* 默认:20px
|
|
42
|
+
*/
|
|
29
43
|
offsetTop: {
|
|
30
44
|
type: PropType<number>;
|
|
31
45
|
default: number;
|
|
32
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* 滚动区域的固定顶部高度
|
|
49
|
+
*
|
|
50
|
+
* 默认:0
|
|
51
|
+
*/
|
|
52
|
+
scrollElementOffsetTop: {
|
|
53
|
+
type: PropType<number>;
|
|
54
|
+
default: number;
|
|
55
|
+
};
|
|
33
56
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
57
|
+
/**
|
|
58
|
+
* 编辑器的Id,务必与需要绑定的编辑器Id相同
|
|
59
|
+
*/
|
|
34
60
|
editorId: {
|
|
35
61
|
type: PropType<string>;
|
|
36
62
|
};
|
|
@@ -42,6 +68,12 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
42
68
|
type: PropType<MarkedHeadingId>;
|
|
43
69
|
default: (text: string) => string;
|
|
44
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* 指定滚动的容器,选择器需带上对应的符号,默认预览框
|
|
73
|
+
* 元素必须定位!!!!!!
|
|
74
|
+
*
|
|
75
|
+
* 默认:#md-editor-preview-wrapper
|
|
76
|
+
*/
|
|
45
77
|
scrollElement: {
|
|
46
78
|
type: PropType<string | HTMLElement>;
|
|
47
79
|
};
|
|
@@ -49,10 +81,24 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
49
81
|
type: PropType<Themes>;
|
|
50
82
|
default: string;
|
|
51
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* 高亮标题相对滚动容器顶部偏移量,即距离该值时,高亮当前目录菜单项
|
|
86
|
+
*
|
|
87
|
+
* 默认:20px
|
|
88
|
+
*/
|
|
52
89
|
offsetTop: {
|
|
53
90
|
type: PropType<number>;
|
|
54
91
|
default: number;
|
|
55
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* 滚动区域的固定顶部高度
|
|
95
|
+
*
|
|
96
|
+
* 默认:0
|
|
97
|
+
*/
|
|
98
|
+
scrollElementOffsetTop: {
|
|
99
|
+
type: PropType<number>;
|
|
100
|
+
default: number;
|
|
101
|
+
};
|
|
56
102
|
}>> & {
|
|
57
103
|
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
58
104
|
}, {
|
|
@@ -60,5 +106,6 @@ declare const MdCatalog: import("vue").DefineComponent<{
|
|
|
60
106
|
class: string;
|
|
61
107
|
markedHeadingId: MarkedHeadingId;
|
|
62
108
|
offsetTop: number;
|
|
109
|
+
scrollElementOffsetTop: number;
|
|
63
110
|
}>;
|
|
64
111
|
export default MdCatalog;
|
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -185,6 +185,21 @@ declare const _default: {
|
|
|
185
185
|
type: import("vue").PropType<string[]>;
|
|
186
186
|
default: string[];
|
|
187
187
|
};
|
|
188
|
+
autoFocus: {
|
|
189
|
+
type: import("vue").PropType<boolean>;
|
|
190
|
+
};
|
|
191
|
+
disabled: {
|
|
192
|
+
type: import("vue").PropType<boolean>;
|
|
193
|
+
};
|
|
194
|
+
readOnly: {
|
|
195
|
+
type: import("vue").PropType<boolean>;
|
|
196
|
+
};
|
|
197
|
+
maxLength: {
|
|
198
|
+
type: import("vue").PropType<number>;
|
|
199
|
+
};
|
|
200
|
+
autoDetectCode: {
|
|
201
|
+
type: import("vue").PropType<boolean>;
|
|
202
|
+
};
|
|
188
203
|
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullscreen" | "preview" | "htmlPreview" | "modelValue" | "theme" | "class" | "historyLength" | "previewOnly" | "language" | "toolbars" | "toolbarsExclude" | "noPrettier" | "editorId" | "tabWidth" | "showCodeRowNumber" | "previewTheme" | "style" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme" | "footers" | "scrollAuto" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList">;
|
|
189
204
|
$attrs: {
|
|
190
205
|
[x: string]: unknown;
|
|
@@ -346,6 +361,21 @@ declare const _default: {
|
|
|
346
361
|
type: import("vue").PropType<string[]>;
|
|
347
362
|
default: string[];
|
|
348
363
|
};
|
|
364
|
+
autoFocus: {
|
|
365
|
+
type: import("vue").PropType<boolean>;
|
|
366
|
+
};
|
|
367
|
+
disabled: {
|
|
368
|
+
type: import("vue").PropType<boolean>;
|
|
369
|
+
};
|
|
370
|
+
readOnly: {
|
|
371
|
+
type: import("vue").PropType<boolean>;
|
|
372
|
+
};
|
|
373
|
+
maxLength: {
|
|
374
|
+
type: import("vue").PropType<number>;
|
|
375
|
+
};
|
|
376
|
+
autoDetectCode: {
|
|
377
|
+
type: import("vue").PropType<boolean>;
|
|
378
|
+
};
|
|
349
379
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
|
|
350
380
|
pageFullscreen: boolean;
|
|
351
381
|
preview: boolean;
|
|
@@ -543,6 +573,21 @@ declare const _default: {
|
|
|
543
573
|
type: import("vue").PropType<string[]>;
|
|
544
574
|
default: string[];
|
|
545
575
|
};
|
|
576
|
+
autoFocus: {
|
|
577
|
+
type: import("vue").PropType<boolean>;
|
|
578
|
+
};
|
|
579
|
+
disabled: {
|
|
580
|
+
type: import("vue").PropType<boolean>;
|
|
581
|
+
};
|
|
582
|
+
readOnly: {
|
|
583
|
+
type: import("vue").PropType<boolean>;
|
|
584
|
+
};
|
|
585
|
+
maxLength: {
|
|
586
|
+
type: import("vue").PropType<number>;
|
|
587
|
+
};
|
|
588
|
+
autoDetectCode: {
|
|
589
|
+
type: import("vue").PropType<boolean>;
|
|
590
|
+
};
|
|
546
591
|
}>> & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
|
|
547
592
|
__isFragment?: undefined;
|
|
548
593
|
__isTeleport?: undefined;
|
|
@@ -694,6 +739,21 @@ declare const _default: {
|
|
|
694
739
|
type: import("vue").PropType<string[]>;
|
|
695
740
|
default: string[];
|
|
696
741
|
};
|
|
742
|
+
autoFocus: {
|
|
743
|
+
type: import("vue").PropType<boolean>;
|
|
744
|
+
};
|
|
745
|
+
disabled: {
|
|
746
|
+
type: import("vue").PropType<boolean>;
|
|
747
|
+
};
|
|
748
|
+
readOnly: {
|
|
749
|
+
type: import("vue").PropType<boolean>;
|
|
750
|
+
};
|
|
751
|
+
maxLength: {
|
|
752
|
+
type: import("vue").PropType<number>;
|
|
753
|
+
};
|
|
754
|
+
autoDetectCode: {
|
|
755
|
+
type: import("vue").PropType<boolean>;
|
|
756
|
+
};
|
|
697
757
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue", {
|
|
698
758
|
pageFullscreen: boolean;
|
|
699
759
|
preview: boolean;
|
|
@@ -725,10 +785,25 @@ declare const _default: {
|
|
|
725
785
|
codeStyleReverse: boolean;
|
|
726
786
|
codeStyleReverseList: string[];
|
|
727
787
|
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
788
|
+
/**
|
|
789
|
+
* 默认工具栏组件
|
|
790
|
+
*/
|
|
728
791
|
readonly NormalToolbar: typeof NormalToolbar;
|
|
792
|
+
/**
|
|
793
|
+
* 下拉菜单工具栏组件
|
|
794
|
+
*/
|
|
729
795
|
readonly DropdownToolbar: typeof DropdownToolbar;
|
|
796
|
+
/**
|
|
797
|
+
* 目录组件
|
|
798
|
+
*/
|
|
730
799
|
readonly MdCatalog: typeof MdCatalog;
|
|
800
|
+
/**
|
|
801
|
+
* 弹窗工具栏组件
|
|
802
|
+
*/
|
|
731
803
|
readonly ModalToolbar: typeof ModalToolbar;
|
|
804
|
+
/**
|
|
805
|
+
* 配置编辑器全局内容
|
|
806
|
+
*/
|
|
732
807
|
readonly config: typeof config;
|
|
733
808
|
install: (app: App) => App;
|
|
734
809
|
};
|
package/lib/MdEditor/type.d.ts
CHANGED
|
@@ -108,6 +108,11 @@ export interface SettingType {
|
|
|
108
108
|
htmlPreview: boolean;
|
|
109
109
|
}
|
|
110
110
|
export declare type Themes = 'light' | 'dark';
|
|
111
|
+
/**
|
|
112
|
+
* 预览主题
|
|
113
|
+
*
|
|
114
|
+
* @list ['default', 'github', 'vuepress', 'mk-cute', 'smart-blue', 'cyanosis']
|
|
115
|
+
*/
|
|
111
116
|
export declare type PreviewThemes = string;
|
|
112
117
|
export interface HeadList {
|
|
113
118
|
text: string;
|
|
@@ -316,4 +321,8 @@ export interface ExposeParam {
|
|
|
316
321
|
*
|
|
317
322
|
*/
|
|
318
323
|
insert(generate: InsertContentGenerator): void;
|
|
324
|
+
/**
|
|
325
|
+
* 手动聚焦
|
|
326
|
+
*/
|
|
327
|
+
focus(): void;
|
|
319
328
|
}
|