md-editor-v3 1.7.0 → 1.8.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 CHANGED
@@ -22,6 +22,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
22
22
  - Upload picture, paste or clip the picture and upload it.
23
23
  - Render article directly(no editor,no event listener, only preview content).
24
24
  - Preview themes, support `defalut`、`vuepress`、`github` styles(not identical).
25
+ - `mermaid`(>=1.3.0).
25
26
 
26
27
  > More features are developing, if you have some ideas or find issues, please tell it to me~
27
28
 
@@ -29,7 +30,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
29
30
 
30
31
  | Default theme | Dark theme | Preview only |
31
32
  | --- | --- | --- |
32
- | ![](https://p1-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/316ecb6e9b3b431aa1a6b0d20d9dabac~tplv-k3u1fbpfcp-watermark.image) | ![](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/611acc4227084ba19875b4b578a01e07~tplv-k3u1fbpfcp-watermark.image) | ![](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/1664c4a5404641c4a1080d64bc6c5831~tplv-k3u1fbpfcp-watermark.image) |
33
+ | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-light.png) | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-dark.png) | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-previewOnly.png) |
33
34
 
34
35
  ## Apis
35
36
 
@@ -65,6 +66,11 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
65
66
  | screenfullJs<sup><v1.4.3</sup> | String | [screenfull@5.1.0](https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js) | Screenfull js url |
66
67
  | previewTheme<sup>v1.4.3</sup> | 'default' \| 'github' \| 'vuepress' | 'default' | Preview themes |
67
68
  | style<sup>v1.7.0</sup> | CSSProperties | {} | Editor's inline style |
69
+ | tableShape<sup>v1.8.0</sup> | [Number, Number] | [6, 4] | Preset the size of the table, [columns, rows]. |
70
+ | mermaid<sup>v1.8.0</sup> | Object | undefined | `mermaid` instance |
71
+ | mermaidJs<sup>v1.8.0</sup> | String | [mermaid@8.13.5](https://cdn.jsdelivr.net/npm/mermaid@8.13.5/dist/mermaid.min.js) | mermaidJs url |
72
+ | noMermaid<sup>v1.8.0</sup> | Boolean | false | do not use mermaid |
73
+ | placeholder<sup>v1.8.0</sup> | String | '' | |
68
74
 
69
75
  [toolbars]
70
76
 
@@ -87,6 +93,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
87
93
  'link',
88
94
  'image',
89
95
  'table',
96
+ 'mermaid',
90
97
  '-',
91
98
  'revoke',
92
99
  'next',
@@ -108,6 +115,37 @@ Expand language,you need to replace all the content here:
108
115
  [StaticTextDefaultValue]
109
116
 
110
117
  ```ts
118
+ export interface ToolbarTips {
119
+ bold?: string;
120
+ underline?: string;
121
+ italic?: string;
122
+ strikeThrough?: string;
123
+ title?: string;
124
+ sub?: string;
125
+ sup?: string;
126
+ quote?: string;
127
+ unorderedList?: string;
128
+ orderedList?: string;
129
+ codeRow?: string;
130
+ code?: string;
131
+ link?: string;
132
+ image?: string;
133
+ table?: string;
134
+ mermaid?: string;
135
+ revoke?: string;
136
+ next?: string;
137
+ save?: string;
138
+ prettier?: string;
139
+ pageFullscreen?: string;
140
+ fullscreen?: string;
141
+ catalog?: string;
142
+ preview?: string;
143
+ htmlPreview?: string;
144
+ github?: string;
145
+ '-'?: string;
146
+ '='?: string;
147
+ }
148
+
111
149
  export interface StaticTextDefaultValue {
112
150
  // Toolbar hover tips(html title)
113
151
  toolbarTips?: ToolbarTips;
@@ -145,6 +183,17 @@ export interface StaticTextDefaultValue {
145
183
  text?: string;
146
184
  tips?: string;
147
185
  };
186
+ // 1.8.0
187
+ mermaid?: {
188
+ flow?: string;
189
+ sequence?: string;
190
+ gantt?: string;
191
+ class?: string;
192
+ state?: string;
193
+ pie?: string;
194
+ relationship?: string;
195
+ journey?: string;
196
+ };
148
197
  }
149
198
  ```
150
199
 
@@ -159,6 +208,7 @@ export interface StaticTextDefaultValue {
159
208
  | onGetCatalog<sup>v1.4.0</sup> | list: HeadList[] | Get catalogue of article |
160
209
  | markedHeading<sup>v1.6.0</sup> | text: string,level: 1-6,raw: string, slugger: Slugger | `marked` head renderer methods |
161
210
  | markedHeadingId<sup>v1.7.0</sup> | (text: string, level: number) => string | title `ID` generator |
211
+ | sanitize | (html: string) => string | Sanitize the html, prevent XSS. |
162
212
 
163
213
  > If `markedHeading` is overridden, be sure to tell the editor the algorithm for generating the title ID by `marketheadingid`.
164
214
 
@@ -6,6 +6,7 @@ declare global {
6
6
  prettierPlugins: any;
7
7
  Cropper: any;
8
8
  screenfull: any;
9
+ mermaid: any;
9
10
  }
10
11
  }
11
12
  export interface ToolbarTips {
@@ -24,6 +25,7 @@ export interface ToolbarTips {
24
25
  link?: string;
25
26
  image?: string;
26
27
  table?: string;
28
+ mermaid?: string;
27
29
  revoke?: string;
28
30
  next?: string;
29
31
  save?: string;
@@ -68,6 +70,16 @@ export interface StaticTextDefaultValue {
68
70
  text?: string;
69
71
  tips?: string;
70
72
  };
73
+ mermaid?: {
74
+ flow?: string;
75
+ sequence?: string;
76
+ gantt?: string;
77
+ class?: string;
78
+ state?: string;
79
+ pie?: string;
80
+ relationship?: string;
81
+ journey?: string;
82
+ };
71
83
  }
72
84
  export interface StaticTextDefault {
73
85
  'zh-CN': StaticTextDefaultValue;
@@ -228,7 +240,7 @@ declare const _default: import("vue").DefineComponent<{
228
240
  };
229
241
  markedHeading: {
230
242
  type: PropType<MarkedHeading>;
231
- default: (text: string, level: number) => string;
243
+ default: (text: string, level: number, raw: string) => string;
232
244
  };
233
245
  style: {
234
246
  type: PropType<string | CSSProperties>;
@@ -238,6 +250,29 @@ declare const _default: import("vue").DefineComponent<{
238
250
  type: PropType<MarkedHeadingId>;
239
251
  default: MarkedHeadingId;
240
252
  };
253
+ tableShape: {
254
+ type: PropType<number[]>;
255
+ default: () => number[];
256
+ };
257
+ mermaid: {
258
+ type: ObjectConstructor;
259
+ };
260
+ mermaidJs: {
261
+ type: PropType<string>;
262
+ default: string;
263
+ };
264
+ noMermaid: {
265
+ type: PropType<boolean>;
266
+ default: boolean;
267
+ };
268
+ sanitize: {
269
+ type: PropType<(html: string) => string>;
270
+ default: (html: string) => string;
271
+ };
272
+ placeholder: {
273
+ type: PropType<string>;
274
+ default: string;
275
+ };
241
276
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
242
277
  modelValue?: unknown;
243
278
  theme?: unknown;
@@ -275,6 +310,12 @@ declare const _default: import("vue").DefineComponent<{
275
310
  markedHeading?: unknown;
276
311
  style?: unknown;
277
312
  markedHeadingId?: unknown;
313
+ tableShape?: unknown;
314
+ mermaid?: unknown;
315
+ mermaidJs?: unknown;
316
+ noMermaid?: unknown;
317
+ sanitize?: unknown;
318
+ placeholder?: unknown;
278
319
  } & {
279
320
  editorId: string;
280
321
  prettier: boolean;
@@ -284,11 +325,11 @@ declare const _default: import("vue").DefineComponent<{
284
325
  tabWidth: number;
285
326
  showCodeRowNumber: boolean;
286
327
  Cropper: Function;
328
+ theme: "dark" | "light";
287
329
  historyLength: number;
288
330
  previewTheme: PreviewThemes;
289
331
  style: string | CSSProperties;
290
332
  modelValue: string;
291
- theme: "dark" | "light";
292
333
  editorClass: string;
293
334
  hljs: Record<string, any>;
294
335
  highlightJs: string;
@@ -309,7 +350,13 @@ declare const _default: import("vue").DefineComponent<{
309
350
  screenfullJs: string;
310
351
  markedHeading: MarkedHeading;
311
352
  markedHeadingId: MarkedHeadingId;
353
+ tableShape: number[];
354
+ mermaidJs: string;
355
+ noMermaid: boolean;
356
+ sanitize: (html: string) => string;
357
+ placeholder: string;
312
358
  } & {
359
+ mermaid?: Record<string, any> | undefined;
313
360
  onSave?: ((v: string) => void) | undefined;
314
361
  onChange?: ((v: string) => void) | undefined;
315
362
  onUploadImg?: ((files: FileList, callBack: (urls: string[]) => void) => void) | undefined;
@@ -324,11 +371,11 @@ declare const _default: import("vue").DefineComponent<{
324
371
  tabWidth: number;
325
372
  showCodeRowNumber: boolean;
326
373
  Cropper: Function;
374
+ theme: "dark" | "light";
327
375
  historyLength: number;
328
376
  previewTheme: PreviewThemes;
329
377
  style: string | CSSProperties;
330
378
  modelValue: string;
331
- theme: "dark" | "light";
332
379
  editorClass: string;
333
380
  hljs: Record<string, any>;
334
381
  highlightJs: string;
@@ -349,5 +396,10 @@ declare const _default: import("vue").DefineComponent<{
349
396
  screenfullJs: string;
350
397
  markedHeading: MarkedHeading;
351
398
  markedHeadingId: MarkedHeadingId;
399
+ tableShape: number[];
400
+ mermaidJs: string;
401
+ noMermaid: boolean;
402
+ sanitize: (html: string) => string;
403
+ placeholder: string;
352
404
  }>;
353
405
  export default _default;