md-editor-v3 2.0.0-beta.0 → 2.0.0-beta.3
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 +8 -4
- package/lib/MdEditor/Editor.d.ts +269 -0
- package/lib/MdEditor/extensions/DropdownToolbar.d.ts +42 -0
- package/lib/MdEditor/extensions/MdCatalog/CatalogLink.d.ts +39 -0
- package/lib/MdEditor/extensions/MdCatalog/index.d.ts +51 -0
- package/lib/MdEditor/extensions/ModalToolbar.d.ts +105 -0
- package/lib/MdEditor/extensions/NormalToolbar.d.ts +30 -0
- package/lib/MdEditor/index.d.ts +612 -0
- package/lib/MdEditor/type.d.ts +221 -0
- package/lib/MdEditor/utils/config.d.ts +3 -0
- package/lib/md-editor-v3.es.js +6369 -0
- package/lib/md-editor-v3.umd.js +116 -0
- package/lib/style.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import type { marked, Renderer } from 'marked';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
hljs: any;
|
|
5
|
+
prettier: any;
|
|
6
|
+
prettierPlugins: any;
|
|
7
|
+
Cropper: any;
|
|
8
|
+
screenfull: any;
|
|
9
|
+
mermaid: any;
|
|
10
|
+
katex: any;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface ToolbarTips {
|
|
14
|
+
bold?: string;
|
|
15
|
+
underline?: string;
|
|
16
|
+
italic?: string;
|
|
17
|
+
strikeThrough?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
sub?: string;
|
|
20
|
+
sup?: string;
|
|
21
|
+
quote?: string;
|
|
22
|
+
unorderedList?: string;
|
|
23
|
+
orderedList?: string;
|
|
24
|
+
codeRow?: string;
|
|
25
|
+
code?: string;
|
|
26
|
+
link?: string;
|
|
27
|
+
image?: string;
|
|
28
|
+
table?: string;
|
|
29
|
+
mermaid?: string;
|
|
30
|
+
katex?: string;
|
|
31
|
+
revoke?: string;
|
|
32
|
+
next?: string;
|
|
33
|
+
save?: string;
|
|
34
|
+
prettier?: string;
|
|
35
|
+
pageFullscreen?: string;
|
|
36
|
+
fullscreen?: string;
|
|
37
|
+
preview?: string;
|
|
38
|
+
htmlPreview?: string;
|
|
39
|
+
catalog?: string;
|
|
40
|
+
github?: string;
|
|
41
|
+
'-'?: string;
|
|
42
|
+
'='?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface StaticTextDefaultValue {
|
|
45
|
+
toolbarTips?: ToolbarTips;
|
|
46
|
+
titleItem?: {
|
|
47
|
+
h1?: string;
|
|
48
|
+
h2?: string;
|
|
49
|
+
h3?: string;
|
|
50
|
+
h4?: string;
|
|
51
|
+
h5?: string;
|
|
52
|
+
h6?: string;
|
|
53
|
+
};
|
|
54
|
+
imgTitleItem?: {
|
|
55
|
+
link: string;
|
|
56
|
+
upload: string;
|
|
57
|
+
clip2upload: string;
|
|
58
|
+
};
|
|
59
|
+
linkModalTips?: {
|
|
60
|
+
title?: string;
|
|
61
|
+
descLable?: string;
|
|
62
|
+
descLablePlaceHolder?: string;
|
|
63
|
+
urlLable?: string;
|
|
64
|
+
UrlLablePlaceHolder?: string;
|
|
65
|
+
buttonOK?: string;
|
|
66
|
+
};
|
|
67
|
+
clipModalTips?: {
|
|
68
|
+
title?: string;
|
|
69
|
+
buttonUpload?: string;
|
|
70
|
+
};
|
|
71
|
+
copyCode?: {
|
|
72
|
+
text?: string;
|
|
73
|
+
tips?: string;
|
|
74
|
+
};
|
|
75
|
+
mermaid?: {
|
|
76
|
+
flow?: string;
|
|
77
|
+
sequence?: string;
|
|
78
|
+
gantt?: string;
|
|
79
|
+
class?: string;
|
|
80
|
+
state?: string;
|
|
81
|
+
pie?: string;
|
|
82
|
+
relationship?: string;
|
|
83
|
+
journey?: string;
|
|
84
|
+
};
|
|
85
|
+
katex?: {
|
|
86
|
+
inline: string;
|
|
87
|
+
block: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface StaticTextDefault {
|
|
91
|
+
'zh-CN': StaticTextDefaultValue;
|
|
92
|
+
'en-US': StaticTextDefaultValue;
|
|
93
|
+
}
|
|
94
|
+
export declare type StaticTextDefaultKey = keyof StaticTextDefault;
|
|
95
|
+
export declare type ToolbarNames = keyof ToolbarTips | number;
|
|
96
|
+
export interface SettingType {
|
|
97
|
+
pageFullScreen: boolean;
|
|
98
|
+
fullscreen: boolean;
|
|
99
|
+
preview: boolean;
|
|
100
|
+
htmlPreview: boolean;
|
|
101
|
+
}
|
|
102
|
+
export declare type Themes = 'light' | 'dark';
|
|
103
|
+
export declare type PreviewThemes = string;
|
|
104
|
+
export interface HeadList {
|
|
105
|
+
text: string;
|
|
106
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
107
|
+
}
|
|
108
|
+
export declare type MarkedHeadingId = (text: string, level: number) => string;
|
|
109
|
+
export interface MermaidTemplate {
|
|
110
|
+
/**
|
|
111
|
+
* 流程图
|
|
112
|
+
*/
|
|
113
|
+
flow?: string;
|
|
114
|
+
/**
|
|
115
|
+
* 时序图
|
|
116
|
+
*/
|
|
117
|
+
sequence?: string;
|
|
118
|
+
/**
|
|
119
|
+
* 甘特图
|
|
120
|
+
*/
|
|
121
|
+
gantt?: string;
|
|
122
|
+
/**
|
|
123
|
+
* 类图
|
|
124
|
+
*/
|
|
125
|
+
class?: string;
|
|
126
|
+
/**
|
|
127
|
+
* 状态图
|
|
128
|
+
*/
|
|
129
|
+
state?: string;
|
|
130
|
+
/**
|
|
131
|
+
* 饼图
|
|
132
|
+
*/
|
|
133
|
+
pie?: string;
|
|
134
|
+
/**
|
|
135
|
+
* 关系图
|
|
136
|
+
*/
|
|
137
|
+
relationship?: string;
|
|
138
|
+
/**
|
|
139
|
+
* 旅程图
|
|
140
|
+
*/
|
|
141
|
+
journey?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface ConfigOption {
|
|
144
|
+
/**
|
|
145
|
+
* 覆盖编辑器默认的renderer属性
|
|
146
|
+
* @see https://marked.js.org/using_pro#renderer
|
|
147
|
+
*/
|
|
148
|
+
markedRenderer?: (renderer: Renderer) => Renderer;
|
|
149
|
+
/**
|
|
150
|
+
* 自定义 marked 扩展
|
|
151
|
+
* @see https://marked.js.org/using_pro#extensions
|
|
152
|
+
*/
|
|
153
|
+
markedExtensions?: Array<marked.TokenizerExtension & marked.RendererExtension>;
|
|
154
|
+
/**
|
|
155
|
+
* 自定义 marked option,不推荐在这么覆盖renderer,这会导致内部逻辑混乱!
|
|
156
|
+
* @see https://marked.js.org/using_advanced#options
|
|
157
|
+
*/
|
|
158
|
+
markedOptions?: marked.MarkedOptions;
|
|
159
|
+
/**
|
|
160
|
+
* 编辑器内部依赖库
|
|
161
|
+
*/
|
|
162
|
+
editorExtensions?: {
|
|
163
|
+
highlight?: {
|
|
164
|
+
instance?: any;
|
|
165
|
+
js?: string;
|
|
166
|
+
css?: CodeCss;
|
|
167
|
+
};
|
|
168
|
+
prettier?: {
|
|
169
|
+
standaloneJs?: string;
|
|
170
|
+
parserMarkdownJs?: string;
|
|
171
|
+
};
|
|
172
|
+
cropper?: {
|
|
173
|
+
instance?: any;
|
|
174
|
+
js?: string;
|
|
175
|
+
css?: string;
|
|
176
|
+
};
|
|
177
|
+
iconfont?: string;
|
|
178
|
+
screenfull?: {
|
|
179
|
+
instance?: any;
|
|
180
|
+
js?: string;
|
|
181
|
+
};
|
|
182
|
+
mermaid?: {
|
|
183
|
+
instance?: any;
|
|
184
|
+
js?: string;
|
|
185
|
+
};
|
|
186
|
+
katex?: {
|
|
187
|
+
instance?: any;
|
|
188
|
+
js?: string;
|
|
189
|
+
css?: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
editorConfig?: {
|
|
193
|
+
/**
|
|
194
|
+
* 自定义提示语言
|
|
195
|
+
*/
|
|
196
|
+
languageUserDefined?: {
|
|
197
|
+
[key: string]: StaticTextDefaultValue;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* 自定义内部mermaid模块
|
|
201
|
+
*/
|
|
202
|
+
mermaidTemplate?: MermaidTemplate;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 扩展编辑器内部功能,包括marked和一些内部依赖实例,如highlight、cropper等
|
|
207
|
+
*/
|
|
208
|
+
export declare type Config = (options: ConfigOption) => void;
|
|
209
|
+
/**
|
|
210
|
+
* 编辑器操作潜在的错误
|
|
211
|
+
*/
|
|
212
|
+
export interface InnerError {
|
|
213
|
+
name: string;
|
|
214
|
+
message: string;
|
|
215
|
+
}
|
|
216
|
+
export interface CodeCss {
|
|
217
|
+
[key: string]: {
|
|
218
|
+
light: string;
|
|
219
|
+
dark: string;
|
|
220
|
+
};
|
|
221
|
+
}
|