md-editor-v3 2.0.0-beta.1 → 2.0.0-beta.4
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 +21 -21
- package/README.md +534 -530
- package/lib/MdEditor/Editor.d.ts +1 -4
- package/lib/MdEditor/extensions/DropdownToolbar.d.ts +1 -4
- package/lib/MdEditor/extensions/{Catalog → MdCatalog}/CatalogLink.d.ts +0 -0
- package/lib/MdEditor/extensions/{Catalog → MdCatalog}/index.d.ts +2 -2
- package/lib/MdEditor/extensions/ModalToolbar.d.ts +1 -10
- package/lib/MdEditor/extensions/NormalToolbar.d.ts +1 -4
- package/lib/MdEditor/index.d.ts +8 -13
- package/lib/md-editor-v3.es.js +20 -24
- package/lib/md-editor-v3.umd.js +26 -26
- package/package.json +132 -132
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -114,13 +114,12 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
114
114
|
};
|
|
115
115
|
onError: {
|
|
116
116
|
type: PropType<(err: InnerError) => void>;
|
|
117
|
-
default: () => () => void;
|
|
118
117
|
};
|
|
119
118
|
codeCssName: {
|
|
120
119
|
type: PropType<string>;
|
|
121
120
|
default: string;
|
|
122
121
|
};
|
|
123
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
122
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
124
123
|
modelValue: {
|
|
125
124
|
type: PropType<string>;
|
|
126
125
|
default: string;
|
|
@@ -233,7 +232,6 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
233
232
|
};
|
|
234
233
|
onError: {
|
|
235
234
|
type: PropType<(err: InnerError) => void>;
|
|
236
|
-
default: () => () => void;
|
|
237
235
|
};
|
|
238
236
|
codeCssName: {
|
|
239
237
|
type: PropType<string>;
|
|
@@ -263,7 +261,6 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
263
261
|
sanitize: (html: string) => string;
|
|
264
262
|
placeholder: string;
|
|
265
263
|
noKatex: boolean;
|
|
266
|
-
onError: (err: InnerError) => void;
|
|
267
264
|
codeCssName: string;
|
|
268
265
|
}>;
|
|
269
266
|
export default Editor;
|
|
@@ -12,12 +12,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
12
12
|
};
|
|
13
13
|
onChange: {
|
|
14
14
|
type: PropType<(visible: boolean) => void>;
|
|
15
|
-
default: () => () => void;
|
|
16
15
|
};
|
|
17
16
|
overlay: {
|
|
18
17
|
type: PropType<string | JSX.Element>;
|
|
19
18
|
};
|
|
20
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
19
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
20
|
title: {
|
|
22
21
|
type: PropType<string>;
|
|
23
22
|
default: string;
|
|
@@ -30,13 +29,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
29
|
};
|
|
31
30
|
onChange: {
|
|
32
31
|
type: PropType<(visible: boolean) => void>;
|
|
33
|
-
default: () => () => void;
|
|
34
32
|
};
|
|
35
33
|
overlay: {
|
|
36
34
|
type: PropType<string | JSX.Element>;
|
|
37
35
|
};
|
|
38
36
|
}>>, {
|
|
39
37
|
title: string;
|
|
40
|
-
onChange: (visible: boolean) => void;
|
|
41
38
|
}>;
|
|
42
39
|
export default _default;
|
|
File without changes
|
|
@@ -5,7 +5,7 @@ export interface TocItem {
|
|
|
5
5
|
level: number;
|
|
6
6
|
children?: Array<TocItem>;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
8
|
+
declare const MdCatalog: import("vue").DefineComponent<{
|
|
9
9
|
editorId: {
|
|
10
10
|
type: PropType<string>;
|
|
11
11
|
};
|
|
@@ -48,4 +48,4 @@ declare const Catalog: import("vue").DefineComponent<{
|
|
|
48
48
|
class: string;
|
|
49
49
|
markedHeadingId: MarkedHeadingId;
|
|
50
50
|
}>;
|
|
51
|
-
export default
|
|
51
|
+
export default MdCatalog;
|
|
@@ -24,11 +24,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
24
|
};
|
|
25
25
|
onClick: {
|
|
26
26
|
type: PropType<() => void>;
|
|
27
|
-
default: () => () => void;
|
|
28
27
|
};
|
|
29
28
|
onClose: {
|
|
30
29
|
type: PropType<() => void>;
|
|
31
|
-
default: () => () => void;
|
|
32
30
|
};
|
|
33
31
|
/**
|
|
34
32
|
* 显示全屏按钮
|
|
@@ -43,9 +41,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
43
41
|
};
|
|
44
42
|
onAdjust: {
|
|
45
43
|
type: PropType<(val: boolean) => void>;
|
|
46
|
-
default: () => () => void;
|
|
47
44
|
};
|
|
48
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
45
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onClick" | "onClose" | "onAdjust", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
49
46
|
title: {
|
|
50
47
|
type: PropType<string>;
|
|
51
48
|
default: string;
|
|
@@ -70,11 +67,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
70
67
|
};
|
|
71
68
|
onClick: {
|
|
72
69
|
type: PropType<() => void>;
|
|
73
|
-
default: () => () => void;
|
|
74
70
|
};
|
|
75
71
|
onClose: {
|
|
76
72
|
type: PropType<() => void>;
|
|
77
|
-
default: () => () => void;
|
|
78
73
|
};
|
|
79
74
|
/**
|
|
80
75
|
* 显示全屏按钮
|
|
@@ -89,17 +84,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
89
84
|
};
|
|
90
85
|
onAdjust: {
|
|
91
86
|
type: PropType<(val: boolean) => void>;
|
|
92
|
-
default: () => () => void;
|
|
93
87
|
};
|
|
94
88
|
}>>, {
|
|
95
89
|
title: string;
|
|
96
|
-
onClick: () => void;
|
|
97
90
|
modalTitle: string;
|
|
98
91
|
width: string;
|
|
99
92
|
height: string;
|
|
100
|
-
onClose: () => void;
|
|
101
93
|
showAdjust: boolean;
|
|
102
94
|
isFullscreen: boolean;
|
|
103
|
-
onAdjust: (val: boolean) => void;
|
|
104
95
|
}>;
|
|
105
96
|
export default _default;
|
|
@@ -9,9 +9,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9
9
|
};
|
|
10
10
|
onClick: {
|
|
11
11
|
type: PropType<(e: MouseEvent) => void>;
|
|
12
|
-
default: () => () => void;
|
|
13
12
|
};
|
|
14
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
13
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
14
|
title: {
|
|
16
15
|
type: PropType<string>;
|
|
17
16
|
default: string;
|
|
@@ -21,10 +20,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
21
20
|
};
|
|
22
21
|
onClick: {
|
|
23
22
|
type: PropType<(e: MouseEvent) => void>;
|
|
24
|
-
default: () => () => void;
|
|
25
23
|
};
|
|
26
24
|
}>>, {
|
|
27
25
|
title: string;
|
|
28
|
-
onClick: (e: MouseEvent) => void;
|
|
29
26
|
}>;
|
|
30
27
|
export default _default;
|
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
1
2
|
import NormalToolbar from './extensions/NormalToolbar';
|
|
2
3
|
import DropdownToolbar from './extensions/DropdownToolbar';
|
|
3
|
-
import
|
|
4
|
+
import MdCatalog from './extensions/MdCatalog';
|
|
4
5
|
import ModalToolbar from './extensions/ModalToolbar';
|
|
5
6
|
import configFn from './utils/config';
|
|
6
7
|
declare const _default: {
|
|
@@ -31,7 +32,6 @@ declare const _default: {
|
|
|
31
32
|
sanitize: (html: string) => string;
|
|
32
33
|
placeholder: string;
|
|
33
34
|
noKatex: boolean;
|
|
34
|
-
onError: (err: import("./type").InnerError) => void;
|
|
35
35
|
codeCssName: string;
|
|
36
36
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
37
37
|
modelValue: {
|
|
@@ -146,13 +146,12 @@ declare const _default: {
|
|
|
146
146
|
};
|
|
147
147
|
onError: {
|
|
148
148
|
type: import("vue").PropType<(err: import("./type").InnerError) => void>;
|
|
149
|
-
default: () => () => void;
|
|
150
149
|
};
|
|
151
150
|
codeCssName: {
|
|
152
151
|
type: import("vue").PropType<string>;
|
|
153
152
|
default: string;
|
|
154
153
|
};
|
|
155
|
-
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "preview" | "htmlPreview" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "noPrettier" | "style" | "class" | "modelValue" | "pageFullScreen" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "
|
|
154
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "editorId" | "preview" | "htmlPreview" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "noPrettier" | "style" | "class" | "modelValue" | "pageFullScreen" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeCssName">;
|
|
156
155
|
$attrs: {
|
|
157
156
|
[x: string]: unknown;
|
|
158
157
|
};
|
|
@@ -164,7 +163,7 @@ declare const _default: {
|
|
|
164
163
|
}>;
|
|
165
164
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
166
165
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
|
|
167
|
-
$emit: (event: string, ...args: any[]) => void;
|
|
166
|
+
$emit: ((event: string, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
168
167
|
$el: any;
|
|
169
168
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
170
169
|
modelValue: {
|
|
@@ -279,13 +278,12 @@ declare const _default: {
|
|
|
279
278
|
};
|
|
280
279
|
onError: {
|
|
281
280
|
type: import("vue").PropType<(err: import("./type").InnerError) => void>;
|
|
282
|
-
default: () => () => void;
|
|
283
281
|
};
|
|
284
282
|
codeCssName: {
|
|
285
283
|
type: import("vue").PropType<string>;
|
|
286
284
|
default: string;
|
|
287
285
|
};
|
|
288
|
-
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
286
|
+
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
|
|
289
287
|
editorId: string;
|
|
290
288
|
preview: boolean;
|
|
291
289
|
htmlPreview: boolean;
|
|
@@ -309,7 +307,6 @@ declare const _default: {
|
|
|
309
307
|
sanitize: (html: string) => string;
|
|
310
308
|
placeholder: string;
|
|
311
309
|
noKatex: boolean;
|
|
312
|
-
onError: (err: import("./type").InnerError) => void;
|
|
313
310
|
codeCssName: string;
|
|
314
311
|
}> & {
|
|
315
312
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -444,7 +441,6 @@ declare const _default: {
|
|
|
444
441
|
};
|
|
445
442
|
onError: {
|
|
446
443
|
type: import("vue").PropType<(err: import("./type").InnerError) => void>;
|
|
447
|
-
default: () => () => void;
|
|
448
444
|
};
|
|
449
445
|
codeCssName: {
|
|
450
446
|
type: import("vue").PropType<string>;
|
|
@@ -567,13 +563,12 @@ declare const _default: {
|
|
|
567
563
|
};
|
|
568
564
|
onError: {
|
|
569
565
|
type: import("vue").PropType<(err: import("./type").InnerError) => void>;
|
|
570
|
-
default: () => () => void;
|
|
571
566
|
};
|
|
572
567
|
codeCssName: {
|
|
573
568
|
type: import("vue").PropType<string>;
|
|
574
569
|
default: string;
|
|
575
570
|
};
|
|
576
|
-
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
571
|
+
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", {
|
|
577
572
|
editorId: string;
|
|
578
573
|
preview: boolean;
|
|
579
574
|
htmlPreview: boolean;
|
|
@@ -597,14 +592,14 @@ declare const _default: {
|
|
|
597
592
|
sanitize: (html: string) => string;
|
|
598
593
|
placeholder: string;
|
|
599
594
|
noKatex: boolean;
|
|
600
|
-
onError: (err: import("./type").InnerError) => void;
|
|
601
595
|
codeCssName: string;
|
|
602
596
|
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
603
597
|
readonly NormalToolbar: typeof NormalToolbar;
|
|
604
598
|
readonly DropdownToolbar: typeof DropdownToolbar;
|
|
605
|
-
readonly
|
|
599
|
+
readonly MdCatalog: typeof MdCatalog;
|
|
606
600
|
readonly ModalToolbar: typeof ModalToolbar;
|
|
607
601
|
readonly config: typeof configFn;
|
|
602
|
+
install: (app: App) => App;
|
|
608
603
|
};
|
|
609
604
|
export default _default;
|
|
610
605
|
export * from './type';
|
package/lib/md-editor-v3.es.js
CHANGED
|
@@ -5800,8 +5800,8 @@ const CatalogLink = defineComponent({
|
|
|
5800
5800
|
}
|
|
5801
5801
|
});
|
|
5802
5802
|
var style = "";
|
|
5803
|
-
const
|
|
5804
|
-
name: "
|
|
5803
|
+
const MdCatalog = defineComponent({
|
|
5804
|
+
name: "MdCatalog",
|
|
5805
5805
|
props: {
|
|
5806
5806
|
editorId: {
|
|
5807
5807
|
type: String
|
|
@@ -6001,9 +6001,7 @@ const props = {
|
|
|
6001
6001
|
type: [String, Object]
|
|
6002
6002
|
},
|
|
6003
6003
|
onError: {
|
|
6004
|
-
type: Function
|
|
6005
|
-
default: () => () => {
|
|
6006
|
-
}
|
|
6004
|
+
type: Function
|
|
6007
6005
|
},
|
|
6008
6006
|
codeCssName: {
|
|
6009
6007
|
type: String,
|
|
@@ -6013,6 +6011,7 @@ const props = {
|
|
|
6013
6011
|
const Editor = defineComponent({
|
|
6014
6012
|
name: "MdEditorV3",
|
|
6015
6013
|
props,
|
|
6014
|
+
emits: ["onChange", "onSave", "onUploadImg", "onHtmlChanged", "onGetCatalog", "onError"],
|
|
6016
6015
|
setup(props2, context) {
|
|
6017
6016
|
const {
|
|
6018
6017
|
editorId
|
|
@@ -6086,7 +6085,11 @@ const Editor = defineComponent({
|
|
|
6086
6085
|
bus.on(editorId, {
|
|
6087
6086
|
name: "errorCatcher",
|
|
6088
6087
|
callback: (err) => {
|
|
6089
|
-
props2.onError
|
|
6088
|
+
if (props2.onError instanceof Function) {
|
|
6089
|
+
props2.onError(err);
|
|
6090
|
+
} else {
|
|
6091
|
+
context.emit("onError", err);
|
|
6092
|
+
}
|
|
6090
6093
|
}
|
|
6091
6094
|
});
|
|
6092
6095
|
});
|
|
@@ -6142,7 +6145,7 @@ const Editor = defineComponent({
|
|
|
6142
6145
|
"placeholder": props2.placeholder,
|
|
6143
6146
|
"noKatex": props2.noKatex,
|
|
6144
6147
|
"mermaidTemplate": (_a = extension == null ? void 0 : extension.editorConfig) == null ? void 0 : _a.mermaidTemplate
|
|
6145
|
-
}, null), catalogShow.value && createVNode(
|
|
6148
|
+
}, null), catalogShow.value && createVNode(MdCatalog, {
|
|
6146
6149
|
"theme": props2.theme,
|
|
6147
6150
|
"style": {
|
|
6148
6151
|
display: state.catalogVisible ? "block" : "none"
|
|
@@ -6165,11 +6168,10 @@ var NormalToolbar = defineComponent({
|
|
|
6165
6168
|
type: [String, Object]
|
|
6166
6169
|
},
|
|
6167
6170
|
onClick: {
|
|
6168
|
-
type: Function
|
|
6169
|
-
default: () => () => {
|
|
6170
|
-
}
|
|
6171
|
+
type: Function
|
|
6171
6172
|
}
|
|
6172
6173
|
},
|
|
6174
|
+
emits: ["onClick"],
|
|
6173
6175
|
setup(props2, ctx) {
|
|
6174
6176
|
return () => {
|
|
6175
6177
|
const Trigger = getSlot({
|
|
@@ -6204,14 +6206,13 @@ var DropdownToolbar = defineComponent({
|
|
|
6204
6206
|
type: [String, Object]
|
|
6205
6207
|
},
|
|
6206
6208
|
onChange: {
|
|
6207
|
-
type: Function
|
|
6208
|
-
default: () => () => {
|
|
6209
|
-
}
|
|
6209
|
+
type: Function
|
|
6210
6210
|
},
|
|
6211
6211
|
overlay: {
|
|
6212
6212
|
type: [String, Object]
|
|
6213
6213
|
}
|
|
6214
6214
|
},
|
|
6215
|
+
emits: ["onChange"],
|
|
6215
6216
|
setup(props2, ctx) {
|
|
6216
6217
|
const editorId = inject("editorId");
|
|
6217
6218
|
return () => {
|
|
@@ -6272,14 +6273,10 @@ var ModalToolbar = defineComponent({
|
|
|
6272
6273
|
type: [String, Object]
|
|
6273
6274
|
},
|
|
6274
6275
|
onClick: {
|
|
6275
|
-
type: Function
|
|
6276
|
-
default: () => () => {
|
|
6277
|
-
}
|
|
6276
|
+
type: Function
|
|
6278
6277
|
},
|
|
6279
6278
|
onClose: {
|
|
6280
|
-
type: Function
|
|
6281
|
-
default: () => () => {
|
|
6282
|
-
}
|
|
6279
|
+
type: Function
|
|
6283
6280
|
},
|
|
6284
6281
|
showAdjust: {
|
|
6285
6282
|
type: Boolean,
|
|
@@ -6290,11 +6287,10 @@ var ModalToolbar = defineComponent({
|
|
|
6290
6287
|
default: false
|
|
6291
6288
|
},
|
|
6292
6289
|
onAdjust: {
|
|
6293
|
-
type: Function
|
|
6294
|
-
default: () => () => {
|
|
6295
|
-
}
|
|
6290
|
+
type: Function
|
|
6296
6291
|
}
|
|
6297
6292
|
},
|
|
6293
|
+
emits: ["onClick", "onClose", "onAdjust"],
|
|
6298
6294
|
setup(props2, ctx) {
|
|
6299
6295
|
return () => {
|
|
6300
6296
|
const Trigger = getSlot({
|
|
@@ -6357,13 +6353,13 @@ Editor.install = (app) => {
|
|
|
6357
6353
|
app.component(Editor.name, Editor);
|
|
6358
6354
|
app.component(NormalToolbar.name, NormalToolbar);
|
|
6359
6355
|
app.component(DropdownToolbar.name, DropdownToolbar);
|
|
6360
|
-
app.component(
|
|
6356
|
+
app.component(MdCatalog.name, MdCatalog);
|
|
6361
6357
|
app.component(ModalToolbar.name, ModalToolbar);
|
|
6362
6358
|
return app;
|
|
6363
6359
|
};
|
|
6364
6360
|
Editor.NormalToolbar = NormalToolbar;
|
|
6365
6361
|
Editor.DropdownToolbar = DropdownToolbar;
|
|
6366
|
-
Editor.
|
|
6362
|
+
Editor.MdCatalog = MdCatalog;
|
|
6367
6363
|
Editor.ModalToolbar = ModalToolbar;
|
|
6368
6364
|
Editor.config = config;
|
|
6369
6365
|
export { Editor as default };
|