md-editor-v3 1.6.3 → 1.7.2
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 +35 -40
- package/lib/MdEditor/Editor.d.ts +19 -3
- package/lib/md-editor-v3.es.js +283 -82
- package/lib/md-editor-v3.umd.js +54 -54
- package/lib/style.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,37 +35,36 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
35
35
|
|
|
36
36
|
### Props
|
|
37
37
|
|
|
38
|
-
| name | type | default |
|
|
39
|
-
| --- | --- | --- | --- |
|
|
40
|
-
| modelValue | String | '' |
|
|
41
|
-
| theme | 'light' \| 'dark' | 'light' |
|
|
42
|
-
| editorClass | String | '' |
|
|
43
|
-
| hljs | Object | null |
|
|
44
|
-
| highlightJs | String | [highlight.js@11.2.0](https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js) |
|
|
45
|
-
| highlightCss | String | [atom-one-dark@11.2.0](https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/atom-one-dark.css) |
|
|
46
|
-
| historyLength | Number | 10 |
|
|
47
|
-
| pageFullScreen | Boolean | false |
|
|
48
|
-
| preview | Boolean | true |
|
|
49
|
-
| htmlPreview | Boolean | false |
|
|
50
|
-
| previewOnly<sup>v1.3.0</sup> | Boolean | false |
|
|
51
|
-
| language | String | 'zh-CN' |
|
|
52
|
-
| languageUserDefined<sup>v1.5.0 changed</sup> | Object | {key: StaticTextDefaultValue} |
|
|
53
|
-
| toolbars | Array | [toolbars] |
|
|
54
|
-
| toolbarsExclude<sup>v1.1.4</sup> | Array | [] |
|
|
55
|
-
| prettier | Boolean | true |
|
|
56
|
-
| prettierCDN | String | [standalone@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js) |
|
|
57
|
-
| prettierMDCDN | String | [parser-markdown@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/parser-markdown.js) |
|
|
58
|
-
| cropperCss<sup>v1.2.0</sup> | String | [cropper.min.css@1.5.12](https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.css) |
|
|
59
|
-
| cropperJs<sup>v1.2.0</sup> | String | [cropper.min.js@1.5.12](https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.js) |
|
|
60
|
-
| iconfontJs<sup>v1.3.2</sup> | String | [iconfont](https://at.alicdn.com/t/font_2605852_khjf435c7th.js) |
|
|
61
|
-
| editorId<sup>v1.4.
|
|
62
|
-
| tabWidth<sup>v1.4.0<sup> | Number | 2 |
|
|
63
|
-
| showCodeRowNumber<sup>v1.4.3</sup> | Boolean | false |
|
|
64
|
-
| screenfull<sup>v1.4.3</sup> | Object | null |
|
|
65
|
-
| screenfullJs<sup><v1.4.3</sup> | String | [screenfull@5.1.0](https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js) |
|
|
66
|
-
| previewTheme<sup>v1.4.3</sup> | 'default' \| 'github' \| 'vuepress' | 'default' |
|
|
67
|
-
|
|
68
|
-
> If responsive is `x`, you can set it's default value once.
|
|
38
|
+
| name | type | default | description |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| modelValue | String | '' | Markdown content,use `v-model` in vue template |
|
|
41
|
+
| theme | 'light' \| 'dark' | 'light' | Change editor theme |
|
|
42
|
+
| editorClass | String | '' | |
|
|
43
|
+
| hljs | Object | null | `Highlight` instance, editor will not insert script of it, but you need to import `highlight` code style by yourself |
|
|
44
|
+
| highlightJs | String | [highlight.js@11.2.0](https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js) | HighlightJs url |
|
|
45
|
+
| highlightCss | String | [atom-one-dark@11.2.0](https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/atom-one-dark.css) | `Highlight` code style |
|
|
46
|
+
| historyLength | Number | 10 | The max length of history(if it is too big, editor will use more `RAM`) |
|
|
47
|
+
| pageFullScreen | Boolean | false | Screenfull in web page |
|
|
48
|
+
| preview | Boolean | true | Preview content in editor |
|
|
49
|
+
| htmlPreview | Boolean | false | Preview html in editor |
|
|
50
|
+
| previewOnly<sup>v1.3.0</sup> | Boolean | false | Only render article content, no toolbar, no edit area |
|
|
51
|
+
| language | String | 'zh-CN' | Build-in language('zh-CN','en-US') |
|
|
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
|
+
| toolbarsExclude<sup>v1.1.4</sup> | Array | [] | Don't show some item of toolbars,all keys`toolbars` |
|
|
55
|
+
| prettier | Boolean | true | Use prettier to beautify content or not |
|
|
56
|
+
| prettierCDN | String | [standalone@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js) | |
|
|
57
|
+
| prettierMDCDN | String | [parser-markdown@2.4.0](https://cdn.jsdelivr.net/npm/prettier@2.4.0/parser-markdown.js) | |
|
|
58
|
+
| cropperCss<sup>v1.2.0</sup> | String | [cropper.min.css@1.5.12](https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.css) | Cropper css url |
|
|
59
|
+
| cropperJs<sup>v1.2.0</sup> | String | [cropper.min.js@1.5.12](https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.js) | Cropper js url |
|
|
60
|
+
| iconfontJs<sup>v1.3.2</sup> | String | [iconfont](https://at.alicdn.com/t/font_2605852_khjf435c7th.js) | Icon url |
|
|
61
|
+
| editorId<sup>[v1.6.4 updated](https://github.com/imzbf/md-editor-v3/releases/tag/v1.6.4)</sup> | String | md-editor-v3 | Editor id, also the html id, it is used when there are more than two editors |
|
|
62
|
+
| tabWidth<sup>v1.4.0<sup> | Number | 2 | One tab eq some space |
|
|
63
|
+
| showCodeRowNumber<sup>v1.4.3</sup> | Boolean | false | Show row number for code block or not |
|
|
64
|
+
| screenfull<sup>v1.4.3</sup> | Object | null | Screenfull instance, editor will not insert script of it |
|
|
65
|
+
| 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
|
+
| previewTheme<sup>v1.4.3</sup> | 'default' \| 'github' \| 'vuepress' | 'default' | Preview themes |
|
|
67
|
+
| style<sup>v1.7.0</sup> | CSSProperties | {} | Editor's inline style |
|
|
69
68
|
|
|
70
69
|
[toolbars]
|
|
71
70
|
|
|
@@ -97,6 +96,7 @@ Markdown editor for vue3, developed by `jsx` and `typescript`.
|
|
|
97
96
|
'fullscreen',
|
|
98
97
|
'preview',
|
|
99
98
|
'htmlPreview',
|
|
99
|
+
'catalog',
|
|
100
100
|
'github'
|
|
101
101
|
];
|
|
102
102
|
```
|
|
@@ -157,7 +157,10 @@ export interface StaticTextDefaultValue {
|
|
|
157
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 |
|
|
158
158
|
| onHtmlChanged | h:String | Compile markdown successful event,you can use it to get the html code |
|
|
159
159
|
| onGetCatalog<sup>v1.4.0</sup> | list: HeadList[] | Get catalogue of article |
|
|
160
|
-
| markedHeading<sup>
|
|
160
|
+
| markedHeading<sup>v1.6.0</sup> | text: string,level: 1-6,raw: string, slugger: Slugger | `marked` head renderer methods |
|
|
161
|
+
| markedHeadingId<sup>v1.7.0</sup> | (text: string, level: number) => string | title `ID` generator |
|
|
162
|
+
|
|
163
|
+
> If `markedHeading` is overridden, be sure to tell the editor the algorithm for generating the title ID by `marketheadingid`.
|
|
161
164
|
|
|
162
165
|
### Shortcut key
|
|
163
166
|
|
|
@@ -263,11 +266,3 @@ async onUploadImg(files: FileList, callback: (urls: string[]) => void) {
|
|
|
263
266
|
callback(res.map((item: any) => item.data.url));
|
|
264
267
|
}
|
|
265
268
|
```
|
|
266
|
-
|
|
267
|
-
## Support
|
|
268
|
-
|
|
269
|
-
> Refund can be made through the contact information above(Please do not operate maliciously).
|
|
270
|
-
|
|
271
|
-
| Alipay | WeChat |
|
|
272
|
-
| --- | --- |
|
|
273
|
-
|  |  |
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
1
|
+
import { PropType, CSSProperties } from 'vue';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
hljs: any;
|
|
@@ -32,6 +32,7 @@ export interface ToolbarTips {
|
|
|
32
32
|
fullscreen?: string;
|
|
33
33
|
preview?: string;
|
|
34
34
|
htmlPreview?: string;
|
|
35
|
+
catalog?: string;
|
|
35
36
|
github?: string;
|
|
36
37
|
'-'?: string;
|
|
37
38
|
'='?: string;
|
|
@@ -94,6 +95,7 @@ export declare type MarkedHeading = (text: string, level: 1 | 2 | 3 | 4 | 5 | 6,
|
|
|
94
95
|
dryrun: boolean;
|
|
95
96
|
}): string;
|
|
96
97
|
}) => string;
|
|
98
|
+
export declare type MarkedHeadingId = (text: string, level: number) => string;
|
|
97
99
|
declare const _default: import("vue").DefineComponent<{
|
|
98
100
|
modelValue: {
|
|
99
101
|
type: PropType<string>;
|
|
@@ -202,7 +204,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
202
204
|
};
|
|
203
205
|
editorId: {
|
|
204
206
|
type: PropType<string>;
|
|
205
|
-
default:
|
|
207
|
+
default: string;
|
|
206
208
|
};
|
|
207
209
|
tabWidth: {
|
|
208
210
|
type: PropType<number>;
|
|
@@ -226,7 +228,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
226
228
|
};
|
|
227
229
|
markedHeading: {
|
|
228
230
|
type: PropType<MarkedHeading>;
|
|
229
|
-
default: (text: string, level: string) => string;
|
|
231
|
+
default: (text: string, level: number, raw: string) => string;
|
|
232
|
+
};
|
|
233
|
+
style: {
|
|
234
|
+
type: PropType<string | CSSProperties>;
|
|
235
|
+
default: () => {};
|
|
236
|
+
};
|
|
237
|
+
markedHeadingId: {
|
|
238
|
+
type: PropType<MarkedHeadingId>;
|
|
239
|
+
default: MarkedHeadingId;
|
|
230
240
|
};
|
|
231
241
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
232
242
|
modelValue?: unknown;
|
|
@@ -263,6 +273,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
263
273
|
screenfullJs?: unknown;
|
|
264
274
|
previewTheme?: unknown;
|
|
265
275
|
markedHeading?: unknown;
|
|
276
|
+
style?: unknown;
|
|
277
|
+
markedHeadingId?: unknown;
|
|
266
278
|
} & {
|
|
267
279
|
editorId: string;
|
|
268
280
|
prettier: boolean;
|
|
@@ -274,6 +286,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
274
286
|
Cropper: Function;
|
|
275
287
|
historyLength: number;
|
|
276
288
|
previewTheme: PreviewThemes;
|
|
289
|
+
style: string | CSSProperties;
|
|
277
290
|
modelValue: string;
|
|
278
291
|
theme: "dark" | "light";
|
|
279
292
|
editorClass: string;
|
|
@@ -295,6 +308,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
295
308
|
screenfull: Record<string, any>;
|
|
296
309
|
screenfullJs: string;
|
|
297
310
|
markedHeading: MarkedHeading;
|
|
311
|
+
markedHeadingId: MarkedHeadingId;
|
|
298
312
|
} & {
|
|
299
313
|
onSave?: ((v: string) => void) | undefined;
|
|
300
314
|
onChange?: ((v: string) => void) | undefined;
|
|
@@ -312,6 +326,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
312
326
|
Cropper: Function;
|
|
313
327
|
historyLength: number;
|
|
314
328
|
previewTheme: PreviewThemes;
|
|
329
|
+
style: string | CSSProperties;
|
|
315
330
|
modelValue: string;
|
|
316
331
|
theme: "dark" | "light";
|
|
317
332
|
editorClass: string;
|
|
@@ -333,5 +348,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
333
348
|
screenfull: Record<string, any>;
|
|
334
349
|
screenfullJs: string;
|
|
335
350
|
markedHeading: MarkedHeading;
|
|
351
|
+
markedHeadingId: MarkedHeadingId;
|
|
336
352
|
}>;
|
|
337
353
|
export default _default;
|