md-editor-v3 1.5.0 → 1.6.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
@@ -1,6 +1,6 @@
1
1
  # md-editor-v3
2
2
 
3
- ![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dw/md-editor-v3) ![](https://img.shields.io/bundlephobia/min/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3)
3
+ ![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dm/md-editor-v3) ![](https://img.shields.io/bundlephobia/min/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3) ![](https://img.shields.io/badge/ssr-%3E1.6.0-brightgreen)
4
4
 
5
5
  English \| [中文](https://github.com/imzbf/md-editor-v3/blob/master/README-CN.md)
6
6
 
@@ -23,7 +23,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
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
25
 
26
- > More features are developing, if you have some ideas or find issues, please tell to me~
26
+ > More features are developing, if you have some ideas or find issues, please tell it to me~
27
27
 
28
28
  ## Preview
29
29
 
@@ -49,8 +49,8 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
49
49
  | htmlPreview | Boolean | false | x | Preview html in editor |
50
50
  | previewOnly<sup>v1.3.0</sup> | Boolean | false | x | Only render article content, no toolbar, no edit area |
51
51
  | language | String | 'zh-CN' | √ | Build-in language('zh-CN','en-US') |
52
- | languageUserDefined<sup>[v1.5.0 changed](https://github.com/imzbf/md-editor-v3/releases/tag/v1.5.0)</sup> | Object | {key: StaticTextDefaultValue} | √ | Expand language,update `language` api to your key |
53
- | toolbars | Array | [all] | √ | Show some item of toolbars,all keys<sup>[toolbars]<sup> |
52
+ | languageUserDefined<sup>v1.5.0 changed</sup> | Object | {key: StaticTextDefaultValue} | √ | Expand language,update `language` api to your key |
53
+ | toolbars | Array | [toolbars] | √ | Show some item of toolbars,all keys<sup>see `toolbars` below<sup> |
54
54
  | toolbarsExclude<sup>v1.1.4</sup> | Array | [] | √ | Don't show some item of toolbars,all keys`toolbars` |
55
55
  | prettier | Boolean | true | x | Use prettier to beautify content or not |
56
56
  | prettierCDN | String | [standalone@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js) | x | |
@@ -74,6 +74,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
74
74
  'bold',
75
75
  'underline',
76
76
  'italic',
77
+ '-',
77
78
  'strikeThrough',
78
79
  'title',
79
80
  'sub',
@@ -81,14 +82,17 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
81
82
  'quote',
82
83
  'unorderedList',
83
84
  'orderedList',
85
+ '-',
84
86
  'codeRow',
85
87
  'code',
86
88
  'link',
87
89
  'image',
88
90
  'table',
91
+ '-',
89
92
  'revoke',
90
93
  'next',
91
94
  'save',
95
+ '=',
92
96
  'pageFullscreen',
93
97
  'fullscreen',
94
98
  'preview',
@@ -97,6 +101,8 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
97
101
  ];
98
102
  ```
99
103
 
104
+ > after v1.6.0, You can sort the toolbar as you like, split tools by `'-'`, the left and right toolbars are divided by `'='`!
105
+
100
106
  Expand language,you need to replace all the content here:
101
107
 
102
108
  [StaticTextDefaultValue]
@@ -114,6 +120,12 @@ export interface StaticTextDefaultValue {
114
120
  h5?: string;
115
121
  h6?: string;
116
122
  };
123
+ // v1.6.0
124
+ imgTitleItem?: {
125
+ link: string;
126
+ upload: string;
127
+ clip2upload: string;
128
+ };
117
129
  // The modal tips of add link or upload picture
118
130
  linkModalTips?: {
119
131
  title?: string;
@@ -122,7 +134,6 @@ export interface StaticTextDefaultValue {
122
134
  urlLable?: string;
123
135
  UrlLablePlaceHolder?: string;
124
136
  buttonOK?: string;
125
- buttonUpload?: string;
126
137
  };
127
138
  // The modal tips of clip the picture,v1.2.0
128
139
  clipModalTips?: {
@@ -146,6 +157,7 @@ export interface StaticTextDefaultValue {
146
157
  | onUploadImg | files:FileList, callback:Function | Upload picture event,when picture is uploading the modal will not close,please provide right urls to the callback function |
147
158
  | onHtmlChanged | h:String | Compile markdown successful event,you can use it to get the html code |
148
159
  | onGetCatalog<sup>v1.4.0</sup> | list: HeadList[] | Get catalogue of article |
160
+ | markedHeading<sup>[v1.6.0](https://github.com/imzbf/md-editor-v3/releases/tag/v1.6.0)</sup> | text: string,level: 1-6,raw: string, slugger: Slugger | `marked` head renderer methods |
149
161
 
150
162
  ### Shortcut key
151
163
 
@@ -1,4 +1,5 @@
1
1
  import { PropType } from 'vue';
2
+ import { Slugger } from 'marked';
2
3
  declare global {
3
4
  interface Window {
4
5
  hljs: any;
@@ -33,6 +34,8 @@ export interface ToolbarTips {
33
34
  preview?: string;
34
35
  htmlPreview?: string;
35
36
  github?: string;
37
+ '-'?: string;
38
+ '='?: string;
36
39
  }
37
40
  export interface StaticTextDefaultValue {
38
41
  toolbarTips?: ToolbarTips;
@@ -44,6 +47,11 @@ export interface StaticTextDefaultValue {
44
47
  h5?: string;
45
48
  h6?: string;
46
49
  };
50
+ imgTitleItem?: {
51
+ link: string;
52
+ upload: string;
53
+ clip2upload: string;
54
+ };
47
55
  linkModalTips?: {
48
56
  title?: string;
49
57
  descLable?: string;
@@ -51,8 +59,6 @@ export interface StaticTextDefaultValue {
51
59
  urlLable?: string;
52
60
  UrlLablePlaceHolder?: string;
53
61
  buttonOK?: string;
54
- buttonUpload?: string;
55
- buttonUploadClip?: string;
56
62
  };
57
63
  clipModalTips?: {
58
64
  title?: string;
@@ -81,6 +87,7 @@ export interface HeadList {
81
87
  level: 1 | 2 | 3 | 4 | 5 | 6;
82
88
  }
83
89
  export declare type PreviewThemes = 'default' | 'github' | 'vuepress';
90
+ export declare type MarkedHeading = (text: string, level: 1 | 2 | 3 | 4 | 5 | 6, raw: string, slugger: Slugger) => string;
84
91
  declare const _default: import("vue").DefineComponent<{
85
92
  modelValue: {
86
93
  type: PropType<string>;
@@ -211,6 +218,10 @@ declare const _default: import("vue").DefineComponent<{
211
218
  type: PropType<PreviewThemes>;
212
219
  default: string;
213
220
  };
221
+ markedHeading: {
222
+ type: PropType<MarkedHeading>;
223
+ default: (text: string, level: string) => string;
224
+ };
214
225
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
215
226
  modelValue?: unknown;
216
227
  theme?: unknown;
@@ -245,6 +256,7 @@ declare const _default: import("vue").DefineComponent<{
245
256
  screenfull?: unknown;
246
257
  screenfullJs?: unknown;
247
258
  previewTheme?: unknown;
259
+ markedHeading?: unknown;
248
260
  } & {
249
261
  prettier: boolean;
250
262
  preview: boolean;
@@ -262,6 +274,7 @@ declare const _default: import("vue").DefineComponent<{
262
274
  toolbarsExclude: (keyof ToolbarTips)[];
263
275
  screenfullJs: string;
264
276
  hljs: Record<string, any>;
277
+ markedHeading: MarkedHeading;
265
278
  modelValue: string;
266
279
  theme: "dark" | "light";
267
280
  editorClass: string;
@@ -299,6 +312,7 @@ declare const _default: import("vue").DefineComponent<{
299
312
  toolbarsExclude: (keyof ToolbarTips)[];
300
313
  screenfullJs: string;
301
314
  hljs: Record<string, any>;
315
+ markedHeading: MarkedHeading;
302
316
  modelValue: string;
303
317
  theme: "dark" | "light";
304
318
  editorClass: string;
@@ -16,10 +16,6 @@ declare const _default: import("vue").DefineComponent<{
16
16
  type: PropType<(v: boolean) => void>;
17
17
  default: () => () => void;
18
18
  };
19
- to: {
20
- type: PropType<HTMLElement>;
21
- default: () => HTMLElement;
22
- };
23
19
  }, () => import("vue").VNode<unknown, unknown, {
24
20
  [key: string]: any;
25
21
  }>[], unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
@@ -27,18 +23,15 @@ declare const _default: import("vue").DefineComponent<{
27
23
  overlay?: unknown;
28
24
  visible?: unknown;
29
25
  onChange?: unknown;
30
- to?: unknown;
31
26
  } & {
32
27
  onChange: (v: boolean) => void;
33
28
  trigger: "click" | "hover";
34
29
  overlay: string | JSX.Element;
35
30
  visible: boolean;
36
- to: HTMLElement;
37
31
  } & {}>, {
38
32
  onChange: (v: boolean) => void;
39
33
  trigger: "click" | "hover";
40
34
  overlay: string | JSX.Element;
41
35
  visible: boolean;
42
- to: HTMLElement;
43
36
  }>;
44
37
  export default _default;
@@ -27,10 +27,6 @@ declare const _default: import("vue").DefineComponent<{
27
27
  type: PropType<() => void>;
28
28
  default: () => () => void;
29
29
  };
30
- to: {
31
- type: PropType<HTMLElement>;
32
- default: () => HTMLElement;
33
- };
34
30
  showAdjust: {
35
31
  type: PropType<boolean>;
36
32
  default: boolean;
@@ -49,14 +45,12 @@ declare const _default: import("vue").DefineComponent<{
49
45
  width?: unknown;
50
46
  height?: unknown;
51
47
  onClosed?: unknown;
52
- to?: unknown;
53
48
  showAdjust?: unknown;
54
49
  isFullscreen?: unknown;
55
50
  onAdjust?: unknown;
56
51
  } & {
57
52
  title: string;
58
53
  visible: boolean;
59
- to: HTMLElement;
60
54
  height: string;
61
55
  width: string;
62
56
  onClosed: () => void;
@@ -66,7 +60,6 @@ declare const _default: import("vue").DefineComponent<{
66
60
  } & {}>, {
67
61
  title: string;
68
62
  visible: boolean;
69
- to: HTMLElement;
70
63
  height: string;
71
64
  width: string;
72
65
  onClosed: () => void;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- import { HeadList, SettingType } from '../../Editor';
2
+ import { HeadList, SettingType, MarkedHeading } from '../../Editor';
3
3
  export declare type EditorContentProps = Readonly<{
4
4
  value: string;
5
5
  hljs: Record<string, any>;
@@ -7,6 +7,7 @@ export declare type EditorContentProps = Readonly<{
7
7
  setting: SettingType;
8
8
  onHtmlChanged: (h: string) => void;
9
9
  onGetCatalog: (list: HeadList[]) => void;
10
+ markedHeading: MarkedHeading;
10
11
  }>;
11
12
  declare const _default: import("vue").DefineComponent<{
12
13
  value: {
@@ -33,6 +34,10 @@ declare const _default: import("vue").DefineComponent<{
33
34
  type: PropType<(list: HeadList[]) => void>;
34
35
  default: () => () => void;
35
36
  };
37
+ markedHeading: {
38
+ type: PropType<MarkedHeading>;
39
+ default: () => (text: string, level: string) => string;
40
+ };
36
41
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
37
42
  value?: unknown;
38
43
  hljs?: unknown;
@@ -40,6 +45,7 @@ declare const _default: import("vue").DefineComponent<{
40
45
  setting?: unknown;
41
46
  onHtmlChanged?: unknown;
42
47
  onGetCatalog?: unknown;
48
+ markedHeading?: unknown;
43
49
  } & {
44
50
  onChange: (v: string) => void;
45
51
  setting: SettingType;
@@ -47,6 +53,7 @@ declare const _default: import("vue").DefineComponent<{
47
53
  hljs: Record<string, any>;
48
54
  onHtmlChanged: (h: string) => void;
49
55
  onGetCatalog: (list: HeadList[]) => void;
56
+ markedHeading: MarkedHeading;
50
57
  } & {}>, {
51
58
  onChange: (v: string) => void;
52
59
  setting: SettingType;
@@ -54,5 +61,6 @@ declare const _default: import("vue").DefineComponent<{
54
61
  hljs: Record<string, any>;
55
62
  onHtmlChanged: (h: string) => void;
56
63
  onGetCatalog: (list: HeadList[]) => void;
64
+ markedHeading: MarkedHeading;
57
65
  }>;
58
66
  export default _default;
@@ -12,23 +12,16 @@ declare const _default: import("vue").DefineComponent<{
12
12
  type: PropType<(data?: any) => void>;
13
13
  default: () => () => void;
14
14
  };
15
- to: {
16
- type: PropType<HTMLElement>;
17
- default: () => HTMLElement;
18
- };
19
15
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
20
16
  visible?: unknown;
21
17
  onCancel?: unknown;
22
18
  onOk?: unknown;
23
- to?: unknown;
24
19
  } & {
25
20
  visible: boolean;
26
- to: HTMLElement;
27
21
  onCancel: () => void;
28
22
  onOk: (data?: any) => void;
29
23
  } & {}>, {
30
24
  visible: boolean;
31
- to: HTMLElement;
32
25
  onCancel: () => void;
33
26
  onOk: (data?: any) => void;
34
27
  }>;
@@ -16,10 +16,6 @@ declare const _default: import("vue").DefineComponent<{
16
16
  type: PropType<(data?: any) => void>;
17
17
  default: () => () => void;
18
18
  };
19
- to: {
20
- type: PropType<HTMLElement>;
21
- default: () => HTMLElement;
22
- };
23
19
  onClip: {
24
20
  type: PropType<() => void>;
25
21
  default: () => () => void;
@@ -29,18 +25,15 @@ declare const _default: import("vue").DefineComponent<{
29
25
  visible?: unknown;
30
26
  onCancel?: unknown;
31
27
  onOk?: unknown;
32
- to?: unknown;
33
28
  onClip?: unknown;
34
29
  } & {
35
30
  visible: boolean;
36
- to: HTMLElement;
37
31
  type: "link" | "image" | "help";
38
32
  onCancel: () => void;
39
33
  onOk: (data?: any) => void;
40
34
  onClip: () => void;
41
35
  } & {}>, {
42
36
  visible: boolean;
43
- to: HTMLElement;
44
37
  type: "link" | "image" | "help";
45
38
  onCancel: () => void;
46
39
  onOk: (data?: any) => void;
@@ -4,7 +4,11 @@ declare const _default: import("vue").DefineComponent<{
4
4
  type: PropType<"link" | "image" | "help">;
5
5
  default: string;
6
6
  };
7
- visible: {
7
+ linkVisible: {
8
+ type: PropType<boolean>;
9
+ default: boolean;
10
+ };
11
+ clipVisible: {
8
12
  type: PropType<boolean>;
9
13
  default: boolean;
10
14
  };
@@ -16,27 +20,23 @@ declare const _default: import("vue").DefineComponent<{
16
20
  type: PropType<(data?: any) => void>;
17
21
  default: () => () => void;
18
22
  };
19
- to: {
20
- type: PropType<HTMLElement>;
21
- default: () => HTMLElement;
22
- };
23
23
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
24
24
  type?: unknown;
25
- visible?: unknown;
25
+ linkVisible?: unknown;
26
+ clipVisible?: unknown;
26
27
  onCancel?: unknown;
27
28
  onOk?: unknown;
28
- to?: unknown;
29
29
  } & {
30
- visible: boolean;
31
- to: HTMLElement;
32
30
  type: "link" | "image" | "help";
33
31
  onCancel: () => void;
34
32
  onOk: (data?: any) => void;
33
+ linkVisible: boolean;
34
+ clipVisible: boolean;
35
35
  } & {}>, {
36
- visible: boolean;
37
- to: HTMLElement;
38
36
  type: "link" | "image" | "help";
39
37
  onCancel: () => void;
40
38
  onOk: (data?: any) => void;
39
+ linkVisible: boolean;
40
+ clipVisible: boolean;
41
41
  }>;
42
42
  export default _default;