md-editor-v3 2.0.1 → 2.1.1

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
@@ -50,10 +50,10 @@ mark and emoji extensions
50
50
  | htmlPreview | boolean | false | Preview html in editor |
51
51
  | previewOnly | boolean | false | Only render article content, no toolbar, no edit area |
52
52
  | language | string | 'zh-CN' | Build-in language('zh-CN','en-US') |
53
- | toolbars | Array | [toolbars] | Show some item of toolbars, all keys<sup>see `toolbars` below</sup> |
54
- | toolbarsExclude | Array | [] | Don't show some item of toolbars, all keys`toolbars` |
53
+ | toolbars | Array<ToolbarNames \| number> | [toolbars] | Show contents of toolbar, all keys<sup>see `toolbars` below</sup> |
54
+ | toolbarsExclude | Array<ToolbarNames \| number> | [] | Don't show contents of toolbar, all keys`toolbars` |
55
55
  | noPrettier | boolean | false | Use prettier to beautify content or not |
56
- | editorId | string | md-editor-v3 | Editor id, it is used when there are more than two editors in the same page. |
56
+ | editorId | string | 'md-editor-v3' | Editor id, it is used when there are more than two editors in the same page |
57
57
  | tabWidth | number | 2 | One tab eq some spaces |
58
58
  | showCodeRowNumber | boolean | false | Show row number for code block or not |
59
59
  | previewTheme | 'default' \| 'github' \| 'vuepress' \| 'mk-cute' \| 'smart-blue' \| 'cyanosis' | 'default' | Preview theme, can be customized |
@@ -62,9 +62,11 @@ mark and emoji extensions
62
62
  | noMermaid | boolean | false | Use mermaid or not |
63
63
  | placeholder | string | '' | |
64
64
  | noKatex | boolean | false | Use katex or not |
65
- | codeTheme | 'atom' \| 'a11y' \| 'github' \| 'gradient' \| 'kimbie' \| 'paraiso' \| 'qtcreator' \| 'stackoverflow' | 'atom' | [Highlight](https://www.jsdelivr.com/package/npm/highlight.js?path=styles) code style, can be customized also |
66
- | markedHeadingId | (text: string, level: number) => string | (text) => text | H1-H6 `ID` generator |
65
+ | codeTheme | 'atom' \| 'a11y' \| 'github' \| 'gradient' \| 'kimbie' \| 'paraiso' \| 'qtcreator' \| 'stackoverflow' | 'atom' | Highlight code style, can be customized also |
66
+ | markedHeadingId | (text: string, level: number, index: number) => string | (text) => text | H1-H6 `ID` generator |
67
67
  | sanitize | (html: string) => string | (html) => html | Sanitize the html, prevent XSS |
68
+ | footers | Array<'markdownTotal' \| '=' \| 'scrollSwitch' \| number> | ['markdownTotal', '=', 'scrollSwitch'] | Show contents of footer, they are divided by `'='`. Set it to `[]` to hidden footer |
69
+ | scrollAuto | boolean | true | Scroll default setting |
68
70
 
69
71
  <details>
70
72
  <summary>[toolbars]</summary>
@@ -151,7 +153,7 @@ export interface ToolbarTips {
151
153
  export interface StaticTextDefaultValue {
152
154
  // Toolbar hover tips(html title)
153
155
  toolbarTips?: ToolbarTips;
154
- // h1-h6 dropdown menu item
156
+ // H1-H6 dropdown menu item
155
157
  titleItem?: {
156
158
  h1?: string;
157
159
  h2?: string;
@@ -160,7 +162,6 @@ export interface StaticTextDefaultValue {
160
162
  h5?: string;
161
163
  h6?: string;
162
164
  };
163
- // v1.6.0
164
165
  imgTitleItem?: {
165
166
  link: string;
166
167
  upload: string;
@@ -180,13 +181,11 @@ export interface StaticTextDefaultValue {
180
181
  title?: string;
181
182
  buttonUpload?: string;
182
183
  };
183
- // Copy code tips, v1.1.4
184
184
  copyCode?: {
185
185
  text?: string;
186
186
  successTips?: string;
187
187
  failTips?: string;
188
188
  };
189
- // 1.8.0
190
189
  mermaid?: {
191
190
  flow?: string;
192
191
  sequence?: string;
@@ -197,13 +196,16 @@ export interface StaticTextDefaultValue {
197
196
  relationship?: string;
198
197
  journey?: string;
199
198
  };
200
- // 1.9.0
201
199
  katex?: {
202
200
  // formula inline
203
201
  inline: string;
204
202
  // formula block
205
203
  block: string;
206
204
  };
205
+ footer?: {
206
+ markdownTotal: string;
207
+ scrollAuto: string;
208
+ };
207
209
  }
208
210
  ```
209
211
 
@@ -214,6 +216,7 @@ export interface StaticTextDefaultValue {
214
216
  | name | type | default | description |
215
217
  | --- | --- | --- | --- |
216
218
  | defToolbars | Array<DropdownToolbar \| NormalToolbar \| ModalToolbar> | null | Custom toolbar in `DropdownToolbar`, `NormalToolbar` or `ModalToolbar` |
219
+ | defFooters | Array<string \| VNode \| JSX.Element> | null | Custom footer |
217
220
 
218
221
  `NormalToolbar` example:
219
222
 
@@ -247,12 +250,12 @@ const handler = () => {
247
250
 
248
251
  | name | param | description |
249
252
  | --- | --- | --- |
250
- | onChange | v:string | Content changed event(bind to `oninput` of `textarea`) |
251
- | onSave | v:string | Save content event, `ctrl+s`and click button will be triggered also |
252
- | onUploadImg | files:Array<File>, callback:Function | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
253
- | onHtmlChanged | h:string | Compile markdown successful event, you can use it to get the html code |
254
- | onGetCatalog | list: HeadList[] | Get catalog of article |
255
- | onError | err: { name: string; message: string } | Catch run-time error, `Cropper`,`fullScreen` and `prettier` are used when they are not loaded |
253
+ | onChange | `value: string` | Content changed event(bind to `oninput` of `textarea`) |
254
+ | onSave | `value: string` | Save content event, `ctrl+s`and click button will be triggered also |
255
+ | onUploadImg | `files: Array<File>, callback: (urls: Array<string>) => void` | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
256
+ | onHtmlChanged | `html: string` | Compile markdown successful event, you can use it to get the html code |
257
+ | onGetCatalog | `list: Array<HeadList>` | Get catalog of article |
258
+ | onError | `err: { name: string; message: string }` | Catch run-time error, `Cropper`, `fullScreen` and `prettier` are used when they are not loaded |
256
259
 
257
260
  ## Config
258
261
 
@@ -1,5 +1,5 @@
1
1
  import { PropType, CSSProperties } from 'vue';
2
- import { ToolbarNames, HeadList, MarkedHeadingId, Themes, InnerError } from './type';
2
+ import { ToolbarNames, HeadList, MarkedHeadingId, Themes, InnerError, Footers } from './type';
3
3
  export declare const markedHeadingId: MarkedHeadingId;
4
4
  declare const Editor: import("vue").DefineComponent<{
5
5
  modelValue: {
@@ -119,6 +119,17 @@ declare const Editor: import("vue").DefineComponent<{
119
119
  type: PropType<string>;
120
120
  default: string;
121
121
  };
122
+ footers: {
123
+ type: PropType<Footers[]>;
124
+ default: Footers[];
125
+ };
126
+ scrollAuto: {
127
+ type: PropType<boolean>;
128
+ default: boolean;
129
+ };
130
+ defFooters: {
131
+ type: PropType<string | JSX.Element>;
132
+ };
122
133
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
123
134
  modelValue: {
124
135
  type: PropType<string>;
@@ -237,6 +248,17 @@ declare const Editor: import("vue").DefineComponent<{
237
248
  type: PropType<string>;
238
249
  default: string;
239
250
  };
251
+ footers: {
252
+ type: PropType<Footers[]>;
253
+ default: Footers[];
254
+ };
255
+ scrollAuto: {
256
+ type: PropType<boolean>;
257
+ default: boolean;
258
+ };
259
+ defFooters: {
260
+ type: PropType<string | JSX.Element>;
261
+ };
240
262
  }>>, {
241
263
  pageFullScreen: boolean;
242
264
  preview: boolean;
@@ -251,6 +273,7 @@ declare const Editor: import("vue").DefineComponent<{
251
273
  previewTheme: string;
252
274
  style: string | CSSProperties;
253
275
  class: string;
276
+ scrollAuto: boolean;
254
277
  modelValue: string;
255
278
  language: string;
256
279
  toolbars: ToolbarNames[];
@@ -262,5 +285,6 @@ declare const Editor: import("vue").DefineComponent<{
262
285
  placeholder: string;
263
286
  noKatex: boolean;
264
287
  codeTheme: string;
288
+ footers: Footers[];
265
289
  }>;
266
290
  export default Editor;
@@ -3,6 +3,7 @@ import { MarkedHeadingId, Themes } from '../../type';
3
3
  export interface TocItem {
4
4
  text: string;
5
5
  level: number;
6
+ index: number;
6
7
  children?: Array<TocItem>;
7
8
  }
8
9
  declare const MdCatalog: import("vue").DefineComponent<{
@@ -22,6 +22,7 @@ declare const _default: {
22
22
  previewTheme: string;
23
23
  style: string | import("vue").CSSProperties;
24
24
  class: string;
25
+ scrollAuto: boolean;
25
26
  modelValue: string;
26
27
  language: string;
27
28
  toolbars: import("./type").ToolbarNames[];
@@ -33,6 +34,7 @@ declare const _default: {
33
34
  placeholder: string;
34
35
  noKatex: boolean;
35
36
  codeTheme: string;
37
+ footers: import("./type").Footers[];
36
38
  }> & Omit<Readonly<import("vue").ExtractPropTypes<{
37
39
  modelValue: {
38
40
  type: import("vue").PropType<string>;
@@ -151,7 +153,18 @@ declare const _default: {
151
153
  type: import("vue").PropType<string>;
152
154
  default: string;
153
155
  };
154
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullScreen" | "preview" | "htmlPreview" | "editorId" | "noPrettier" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "style" | "class" | "modelValue" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme">;
156
+ footers: {
157
+ type: import("vue").PropType<import("./type").Footers[]>;
158
+ default: import("./type").Footers[];
159
+ };
160
+ scrollAuto: {
161
+ type: import("vue").PropType<boolean>;
162
+ default: boolean;
163
+ };
164
+ defFooters: {
165
+ type: import("vue").PropType<string | JSX.Element>;
166
+ };
167
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullScreen" | "preview" | "htmlPreview" | "editorId" | "noPrettier" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "style" | "class" | "scrollAuto" | "modelValue" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme" | "footers">;
155
168
  $attrs: {
156
169
  [x: string]: unknown;
157
170
  };
@@ -283,6 +296,17 @@ declare const _default: {
283
296
  type: import("vue").PropType<string>;
284
297
  default: string;
285
298
  };
299
+ footers: {
300
+ type: import("vue").PropType<import("./type").Footers[]>;
301
+ default: import("./type").Footers[];
302
+ };
303
+ scrollAuto: {
304
+ type: import("vue").PropType<boolean>;
305
+ default: boolean;
306
+ };
307
+ defFooters: {
308
+ type: import("vue").PropType<string | JSX.Element>;
309
+ };
286
310
  }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
287
311
  pageFullScreen: boolean;
288
312
  preview: boolean;
@@ -297,6 +321,7 @@ declare const _default: {
297
321
  previewTheme: string;
298
322
  style: string | import("vue").CSSProperties;
299
323
  class: string;
324
+ scrollAuto: boolean;
300
325
  modelValue: string;
301
326
  language: string;
302
327
  toolbars: import("./type").ToolbarNames[];
@@ -308,6 +333,7 @@ declare const _default: {
308
333
  placeholder: string;
309
334
  noKatex: boolean;
310
335
  codeTheme: string;
336
+ footers: import("./type").Footers[];
311
337
  }> & {
312
338
  beforeCreate?: ((() => void) | (() => void)[]) | undefined;
313
339
  created?: ((() => void) | (() => void)[]) | undefined;
@@ -446,6 +472,17 @@ declare const _default: {
446
472
  type: import("vue").PropType<string>;
447
473
  default: string;
448
474
  };
475
+ footers: {
476
+ type: import("vue").PropType<import("./type").Footers[]>;
477
+ default: import("./type").Footers[];
478
+ };
479
+ scrollAuto: {
480
+ type: import("vue").PropType<boolean>;
481
+ default: boolean;
482
+ };
483
+ defFooters: {
484
+ type: import("vue").PropType<string | JSX.Element>;
485
+ };
449
486
  }>> & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
450
487
  __isFragment?: undefined;
451
488
  __isTeleport?: undefined;
@@ -568,6 +605,17 @@ declare const _default: {
568
605
  type: import("vue").PropType<string>;
569
606
  default: string;
570
607
  };
608
+ footers: {
609
+ type: import("vue").PropType<import("./type").Footers[]>;
610
+ default: import("./type").Footers[];
611
+ };
612
+ scrollAuto: {
613
+ type: import("vue").PropType<boolean>;
614
+ default: boolean;
615
+ };
616
+ defFooters: {
617
+ type: import("vue").PropType<string | JSX.Element>;
618
+ };
571
619
  }>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", {
572
620
  pageFullScreen: boolean;
573
621
  preview: boolean;
@@ -582,6 +630,7 @@ declare const _default: {
582
630
  previewTheme: string;
583
631
  style: string | import("vue").CSSProperties;
584
632
  class: string;
633
+ scrollAuto: boolean;
585
634
  modelValue: string;
586
635
  language: string;
587
636
  toolbars: import("./type").ToolbarNames[];
@@ -593,6 +642,7 @@ declare const _default: {
593
642
  placeholder: string;
594
643
  noKatex: boolean;
595
644
  codeTheme: string;
645
+ footers: import("./type").Footers[];
596
646
  }> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & {
597
647
  readonly NormalToolbar: typeof NormalToolbar;
598
648
  readonly DropdownToolbar: typeof DropdownToolbar;
@@ -87,6 +87,10 @@ export interface StaticTextDefaultValue {
87
87
  inline: string;
88
88
  block: string;
89
89
  };
90
+ footer?: {
91
+ markdownTotal: string;
92
+ scrollAuto: string;
93
+ };
90
94
  }
91
95
  export interface StaticTextDefault {
92
96
  'zh-CN': StaticTextDefaultValue;
@@ -94,6 +98,7 @@ export interface StaticTextDefault {
94
98
  }
95
99
  export declare type StaticTextDefaultKey = keyof StaticTextDefault;
96
100
  export declare type ToolbarNames = keyof ToolbarTips | number;
101
+ export declare type Footers = '=' | 'markdownTotal' | 'scrollSwitch' | number;
97
102
  export interface SettingType {
98
103
  pageFullScreen: boolean;
99
104
  fullscreen: boolean;
@@ -106,7 +111,7 @@ export interface HeadList {
106
111
  text: string;
107
112
  level: 1 | 2 | 3 | 4 | 5 | 6;
108
113
  }
109
- export declare type MarkedHeadingId = (text: string, level: number) => string;
114
+ export declare type MarkedHeadingId = (text: string, level: number, index: number) => string;
110
115
  export interface MermaidTemplate {
111
116
  /**
112
117
  * 流程图