md-editor-v3 2.11.0 → 3.0.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 +23 -49
- package/lib/MdEditor/Editor.d.ts +43 -43
- package/lib/MdEditor/extensions/MdCatalog/CatalogLink.d.ts +11 -11
- package/lib/MdEditor/extensions/MdCatalog/index.d.ts +6 -6
- package/lib/MdEditor/index.d.ts +35 -35
- package/lib/MdEditor/type.d.ts +18 -21
- package/lib/md-editor-v3.cjs +27 -88
- package/lib/md-editor-v3.mjs +2529 -4957
- package/lib/md-editor-v3.umd.js +77 -89
- package/lib/style.css +1 -1
- package/package.json +19 -12
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ declare const _default: {
|
|
|
15
15
|
modelValue: string;
|
|
16
16
|
theme: import("./type").Themes;
|
|
17
17
|
class: string;
|
|
18
|
-
historyLength: number;
|
|
19
18
|
previewOnly: boolean;
|
|
20
19
|
language: string;
|
|
21
20
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -26,7 +25,7 @@ declare const _default: {
|
|
|
26
25
|
showCodeRowNumber: boolean;
|
|
27
26
|
previewTheme: string;
|
|
28
27
|
style: string | import("vue").CSSProperties;
|
|
29
|
-
|
|
28
|
+
mdHeadingId: import("./type").MdHeadingId;
|
|
30
29
|
tableShape: number[];
|
|
31
30
|
noMermaid: boolean;
|
|
32
31
|
sanitize: (html: string) => string;
|
|
@@ -38,6 +37,7 @@ declare const _default: {
|
|
|
38
37
|
formatCopiedText: (text: string) => string;
|
|
39
38
|
codeStyleReverse: boolean;
|
|
40
39
|
codeStyleReverseList: string[];
|
|
40
|
+
noHighlight: boolean;
|
|
41
41
|
}> & Omit<Readonly<import("vue").ExtractPropTypes<{
|
|
42
42
|
modelValue: {
|
|
43
43
|
type: import("vue").PropType<string>;
|
|
@@ -51,10 +51,6 @@ declare const _default: {
|
|
|
51
51
|
type: StringConstructor;
|
|
52
52
|
default: string;
|
|
53
53
|
};
|
|
54
|
-
historyLength: {
|
|
55
|
-
type: import("vue").PropType<number>;
|
|
56
|
-
default: number;
|
|
57
|
-
};
|
|
58
54
|
onChange: {
|
|
59
55
|
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
60
56
|
};
|
|
@@ -122,9 +118,9 @@ declare const _default: {
|
|
|
122
118
|
type: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
123
119
|
default: () => {};
|
|
124
120
|
};
|
|
125
|
-
|
|
126
|
-
type: import("vue").PropType<import("./type").
|
|
127
|
-
default: import("./type").
|
|
121
|
+
mdHeadingId: {
|
|
122
|
+
type: import("vue").PropType<import("./type").MdHeadingId>;
|
|
123
|
+
default: import("./type").MdHeadingId;
|
|
128
124
|
};
|
|
129
125
|
tableShape: {
|
|
130
126
|
type: import("vue").PropType<number[]>;
|
|
@@ -206,6 +202,10 @@ declare const _default: {
|
|
|
206
202
|
onFocus: {
|
|
207
203
|
type: import("vue").PropType<(event: FocusEvent) => void>;
|
|
208
204
|
};
|
|
205
|
+
noHighlight: {
|
|
206
|
+
type: import("vue").PropType<boolean>;
|
|
207
|
+
default: boolean;
|
|
208
|
+
};
|
|
209
209
|
}>> & {
|
|
210
210
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
211
211
|
onOnSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -216,7 +216,7 @@ declare const _default: {
|
|
|
216
216
|
onOnBlur?: ((...args: any[]) => any) | undefined;
|
|
217
217
|
onOnFocus?: ((...args: any[]) => any) | undefined;
|
|
218
218
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
219
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullscreen" | "preview" | "htmlPreview" | "modelValue" | "theme" | "class" | "
|
|
219
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullscreen" | "preview" | "htmlPreview" | "modelValue" | "theme" | "class" | "previewOnly" | "language" | "toolbars" | "toolbarsExclude" | "noPrettier" | "editorId" | "tabWidth" | "showCodeRowNumber" | "previewTheme" | "style" | "mdHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme" | "footers" | "scrollAuto" | "formatCopiedText" | "codeStyleReverse" | "codeStyleReverseList" | "noHighlight">;
|
|
220
220
|
$attrs: {
|
|
221
221
|
[x: string]: unknown;
|
|
222
222
|
};
|
|
@@ -243,10 +243,6 @@ declare const _default: {
|
|
|
243
243
|
type: StringConstructor;
|
|
244
244
|
default: string;
|
|
245
245
|
};
|
|
246
|
-
historyLength: {
|
|
247
|
-
type: import("vue").PropType<number>;
|
|
248
|
-
default: number;
|
|
249
|
-
};
|
|
250
246
|
onChange: {
|
|
251
247
|
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
252
248
|
};
|
|
@@ -314,9 +310,9 @@ declare const _default: {
|
|
|
314
310
|
type: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
315
311
|
default: () => {};
|
|
316
312
|
};
|
|
317
|
-
|
|
318
|
-
type: import("vue").PropType<import("./type").
|
|
319
|
-
default: import("./type").
|
|
313
|
+
mdHeadingId: {
|
|
314
|
+
type: import("vue").PropType<import("./type").MdHeadingId>;
|
|
315
|
+
default: import("./type").MdHeadingId;
|
|
320
316
|
};
|
|
321
317
|
tableShape: {
|
|
322
318
|
type: import("vue").PropType<number[]>;
|
|
@@ -398,6 +394,10 @@ declare const _default: {
|
|
|
398
394
|
onFocus: {
|
|
399
395
|
type: import("vue").PropType<(event: FocusEvent) => void>;
|
|
400
396
|
};
|
|
397
|
+
noHighlight: {
|
|
398
|
+
type: import("vue").PropType<boolean>;
|
|
399
|
+
default: boolean;
|
|
400
|
+
};
|
|
401
401
|
}>> & {
|
|
402
402
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
403
403
|
onOnSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -415,7 +415,6 @@ declare const _default: {
|
|
|
415
415
|
modelValue: string;
|
|
416
416
|
theme: import("./type").Themes;
|
|
417
417
|
class: string;
|
|
418
|
-
historyLength: number;
|
|
419
418
|
previewOnly: boolean;
|
|
420
419
|
language: string;
|
|
421
420
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -426,7 +425,7 @@ declare const _default: {
|
|
|
426
425
|
showCodeRowNumber: boolean;
|
|
427
426
|
previewTheme: string;
|
|
428
427
|
style: string | import("vue").CSSProperties;
|
|
429
|
-
|
|
428
|
+
mdHeadingId: import("./type").MdHeadingId;
|
|
430
429
|
tableShape: number[];
|
|
431
430
|
noMermaid: boolean;
|
|
432
431
|
sanitize: (html: string) => string;
|
|
@@ -438,6 +437,7 @@ declare const _default: {
|
|
|
438
437
|
formatCopiedText: (text: string) => string;
|
|
439
438
|
codeStyleReverse: boolean;
|
|
440
439
|
codeStyleReverseList: string[];
|
|
440
|
+
noHighlight: boolean;
|
|
441
441
|
}, {}, string> & {
|
|
442
442
|
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
443
443
|
created?: ((() => void) | (() => void)[]) | undefined;
|
|
@@ -471,10 +471,6 @@ declare const _default: {
|
|
|
471
471
|
type: StringConstructor;
|
|
472
472
|
default: string;
|
|
473
473
|
};
|
|
474
|
-
historyLength: {
|
|
475
|
-
type: import("vue").PropType<number>;
|
|
476
|
-
default: number;
|
|
477
|
-
};
|
|
478
474
|
onChange: {
|
|
479
475
|
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
480
476
|
};
|
|
@@ -542,9 +538,9 @@ declare const _default: {
|
|
|
542
538
|
type: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
543
539
|
default: () => {};
|
|
544
540
|
};
|
|
545
|
-
|
|
546
|
-
type: import("vue").PropType<import("./type").
|
|
547
|
-
default: import("./type").
|
|
541
|
+
mdHeadingId: {
|
|
542
|
+
type: import("vue").PropType<import("./type").MdHeadingId>;
|
|
543
|
+
default: import("./type").MdHeadingId;
|
|
548
544
|
};
|
|
549
545
|
tableShape: {
|
|
550
546
|
type: import("vue").PropType<number[]>;
|
|
@@ -626,6 +622,10 @@ declare const _default: {
|
|
|
626
622
|
onFocus: {
|
|
627
623
|
type: import("vue").PropType<(event: FocusEvent) => void>;
|
|
628
624
|
};
|
|
625
|
+
noHighlight: {
|
|
626
|
+
type: import("vue").PropType<boolean>;
|
|
627
|
+
default: boolean;
|
|
628
|
+
};
|
|
629
629
|
}>> & {
|
|
630
630
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
631
631
|
onOnSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -653,10 +653,6 @@ declare const _default: {
|
|
|
653
653
|
type: StringConstructor;
|
|
654
654
|
default: string;
|
|
655
655
|
};
|
|
656
|
-
historyLength: {
|
|
657
|
-
type: import("vue").PropType<number>;
|
|
658
|
-
default: number;
|
|
659
|
-
};
|
|
660
656
|
onChange: {
|
|
661
657
|
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
662
658
|
};
|
|
@@ -724,9 +720,9 @@ declare const _default: {
|
|
|
724
720
|
type: import("vue").PropType<string | import("vue").CSSProperties>;
|
|
725
721
|
default: () => {};
|
|
726
722
|
};
|
|
727
|
-
|
|
728
|
-
type: import("vue").PropType<import("./type").
|
|
729
|
-
default: import("./type").
|
|
723
|
+
mdHeadingId: {
|
|
724
|
+
type: import("vue").PropType<import("./type").MdHeadingId>;
|
|
725
|
+
default: import("./type").MdHeadingId;
|
|
730
726
|
};
|
|
731
727
|
tableShape: {
|
|
732
728
|
type: import("vue").PropType<number[]>;
|
|
@@ -808,6 +804,10 @@ declare const _default: {
|
|
|
808
804
|
onFocus: {
|
|
809
805
|
type: import("vue").PropType<(event: FocusEvent) => void>;
|
|
810
806
|
};
|
|
807
|
+
noHighlight: {
|
|
808
|
+
type: import("vue").PropType<boolean>;
|
|
809
|
+
default: boolean;
|
|
810
|
+
};
|
|
811
811
|
}>> & {
|
|
812
812
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
813
813
|
onOnSave?: ((...args: any[]) => any) | undefined;
|
|
@@ -825,7 +825,6 @@ declare const _default: {
|
|
|
825
825
|
modelValue: string;
|
|
826
826
|
theme: import("./type").Themes;
|
|
827
827
|
class: string;
|
|
828
|
-
historyLength: number;
|
|
829
828
|
previewOnly: boolean;
|
|
830
829
|
language: string;
|
|
831
830
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -836,7 +835,7 @@ declare const _default: {
|
|
|
836
835
|
showCodeRowNumber: boolean;
|
|
837
836
|
previewTheme: string;
|
|
838
837
|
style: string | import("vue").CSSProperties;
|
|
839
|
-
|
|
838
|
+
mdHeadingId: import("./type").MdHeadingId;
|
|
840
839
|
tableShape: number[];
|
|
841
840
|
noMermaid: boolean;
|
|
842
841
|
sanitize: (html: string) => string;
|
|
@@ -848,6 +847,7 @@ declare const _default: {
|
|
|
848
847
|
formatCopiedText: (text: string) => string;
|
|
849
848
|
codeStyleReverse: boolean;
|
|
850
849
|
codeStyleReverseList: string[];
|
|
850
|
+
noHighlight: boolean;
|
|
851
851
|
}, {}, string> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
|
|
852
852
|
/**
|
|
853
853
|
* 默认工具栏组件
|
package/lib/MdEditor/type.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { marked, Renderer, Slugger } from 'marked';
|
|
2
1
|
import { LooseRequired } from '@vue/shared';
|
|
3
2
|
import { ExtractPropTypes, SetupContext } from 'vue';
|
|
3
|
+
import { Extension } from '@codemirror/state';
|
|
4
|
+
import { KeyBinding } from '@codemirror/view';
|
|
4
5
|
import { editorProps } from './props';
|
|
5
6
|
declare global {
|
|
6
7
|
interface Window {
|
|
@@ -122,7 +123,7 @@ export interface HeadList {
|
|
|
122
123
|
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
123
124
|
active?: boolean;
|
|
124
125
|
}
|
|
125
|
-
export type
|
|
126
|
+
export type MdHeadingId = (text: string, level: number, index: number) => string;
|
|
126
127
|
export interface MermaidTemplate {
|
|
127
128
|
/**
|
|
128
129
|
* 流程图
|
|
@@ -157,26 +158,7 @@ export interface MermaidTemplate {
|
|
|
157
158
|
*/
|
|
158
159
|
journey?: string;
|
|
159
160
|
}
|
|
160
|
-
export type RewriteHeading = (text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string, slugger: Slugger, index: number, headingId: string) => string;
|
|
161
|
-
export interface RewriteRenderer extends Omit<Renderer, 'heading'> {
|
|
162
|
-
heading: RewriteHeading;
|
|
163
|
-
}
|
|
164
161
|
export interface ConfigOption {
|
|
165
|
-
/**
|
|
166
|
-
* 覆盖编辑器默认的renderer属性
|
|
167
|
-
* @see https://marked.js.org/using_pro#renderer
|
|
168
|
-
*/
|
|
169
|
-
markedRenderer?: (renderer: RewriteRenderer) => RewriteRenderer;
|
|
170
|
-
/**
|
|
171
|
-
* 自定义 marked 扩展
|
|
172
|
-
* @see https://marked.js.org/using_pro#extensions
|
|
173
|
-
*/
|
|
174
|
-
markedExtensions?: Array<marked.TokenizerExtension & marked.RendererExtension>;
|
|
175
|
-
/**
|
|
176
|
-
* 自定义 marked option,不推荐在这么覆盖renderer,这会导致内部逻辑混乱!
|
|
177
|
-
* @see https://marked.js.org/using_advanced#options
|
|
178
|
-
*/
|
|
179
|
-
markedOptions?: marked.MarkedOptions;
|
|
180
162
|
/**
|
|
181
163
|
* 编辑器内部依赖库
|
|
182
164
|
*/
|
|
@@ -228,6 +210,21 @@ export interface ConfigOption {
|
|
|
228
210
|
*/
|
|
229
211
|
renderDelay?: number;
|
|
230
212
|
};
|
|
213
|
+
/**
|
|
214
|
+
* 根据主题和内部默认的codeMirror扩展自定义新的扩展
|
|
215
|
+
*
|
|
216
|
+
* @params theme 当前主题
|
|
217
|
+
* @params innerExtensions 当前主题下的扩展列表
|
|
218
|
+
* [keymap, minimalSetup, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
219
|
+
* [快捷键, 最低配置, markdown识别, 横向自动换行, 更新事件, dom监听事件, oneDark主题(暗夜模式下), oneLight(默认模式下)]
|
|
220
|
+
*
|
|
221
|
+
* @params keyBindings md-editor-v3内置的快捷键
|
|
222
|
+
*/
|
|
223
|
+
codeMirrorExtensions?: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding>) => Array<Extension>;
|
|
224
|
+
/**
|
|
225
|
+
* 自定义markdown-it核心库扩展、属性等
|
|
226
|
+
*/
|
|
227
|
+
markdownItConfig?: (md: markdownit) => void;
|
|
231
228
|
}
|
|
232
229
|
/**
|
|
233
230
|
* 扩展编辑器内部功能,包括marked和一些内部依赖实例,如highlight、cropper等
|