md-editor-v3 2.4.2 → 2.5.0-beta.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 +200 -63
- package/lib/MdEditor/Editor.d.ts +33 -16
- package/lib/MdEditor/config.d.ts +1 -1
- package/lib/MdEditor/index.d.ts +70 -32
- package/lib/MdEditor/type.d.ts +86 -6
- package/lib/md-editor-v3.es.js +322 -177
- package/lib/md-editor-v3.umd.js +36 -36
- package/lib/style.css +1 -1
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# md-editor-v3
|
|
1
|
+
# 🎄 md-editor-v3
|
|
2
2
|
|
|
3
3
|
    
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
|
12
12
|
|
|
13
13
|
- The same series editor for react: [md-editor-rt](https://github.com/imzbf/md-editor-rt)
|
|
14
14
|
|
|
15
|
-
## Features
|
|
15
|
+
## ⭐️ Features
|
|
16
16
|
|
|
17
17
|
- Toolbar, screenfull or screenfull in web pages and so on.
|
|
18
18
|
- Themes, Built-in default and dark themes.
|
|
@@ -20,12 +20,12 @@ Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
|
20
20
|
- Beautify your content by `prettier`(only for markdown content, not the code and other text).
|
|
21
21
|
- Multi-language, build-in Chinese and English(default: Chinese).
|
|
22
22
|
- Upload picture, paste or clip the picture and upload it.
|
|
23
|
-
- Render article directly(no editor, no event listener, only preview content).
|
|
24
|
-
-
|
|
23
|
+
- Render article directly(no editor, no event listener, only preview of content).
|
|
24
|
+
- Theme of preview, `defalut`, `vuepress`, `github`, `cyanosis`, `mk-cute`, `smart-blue` styles(not identical). It can be customized also(Refer to example page).
|
|
25
25
|
- `mermaid`(>=1.8.0), `katex` mathematical formula(>=1.9.0).
|
|
26
26
|
- Customize the toolbar as you like.
|
|
27
27
|
|
|
28
|
-
## Install
|
|
28
|
+
## 📦 Install
|
|
29
29
|
|
|
30
30
|
```shell
|
|
31
31
|
yarn add md-editor-v3
|
|
@@ -37,7 +37,7 @@ Please install `@types/marked` in your typescript project if you want to configu
|
|
|
37
37
|
yarn add @types/marked -D
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Install existing extension of language and preview
|
|
40
|
+
Install existing extension of language and theme of preview:
|
|
41
41
|
|
|
42
42
|
```shell
|
|
43
43
|
yarn add @vavt/md-editor-extension
|
|
@@ -45,7 +45,7 @@ yarn add @vavt/md-editor-extension
|
|
|
45
45
|
|
|
46
46
|
For more ways to use or contribute, please refer to: [md-editor-extension](https://github.com/imzbf/md-editor-extension)
|
|
47
47
|
|
|
48
|
-
## Usage
|
|
48
|
+
## 💡 Usage
|
|
49
49
|
|
|
50
50
|
```vue
|
|
51
51
|
<template>
|
|
@@ -61,7 +61,7 @@ const text = ref('# Hello Editor');
|
|
|
61
61
|
</script>
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
## Preview
|
|
64
|
+
## 🗺 Preview
|
|
65
65
|
|
|
66
66
|
| Default theme | Dark theme | Preview only |
|
|
67
67
|
| --- | --- | --- |
|
|
@@ -71,44 +71,46 @@ mark and emoji extensions
|
|
|
71
71
|
|
|
72
72
|

|
|
73
73
|
|
|
74
|
-
## Apis
|
|
74
|
+
## 🎁 Apis
|
|
75
75
|
|
|
76
|
-
### Props
|
|
76
|
+
### 🔩 Props
|
|
77
77
|
|
|
78
78
|
| name | type | default | description |
|
|
79
79
|
| --- | --- | --- | --- |
|
|
80
|
-
| modelValue | string | '' | Markdown content, use `v-model` in vue template |
|
|
81
|
-
| theme | 'light' \| 'dark' | 'light' | Editor theme |
|
|
82
|
-
| class | string | '' | |
|
|
83
|
-
| historyLength | number | 10 | The max length of history(if it is too big, editor will use more `RAM`) |
|
|
84
|
-
|
|
|
85
|
-
| preview | boolean | true | Preview content in editor |
|
|
86
|
-
| htmlPreview | boolean | false | Preview html in editor |
|
|
87
|
-
| previewOnly | boolean | false | Only render
|
|
88
|
-
| language | string | 'zh-CN' | Build-in language('zh-CN','en-US') |
|
|
89
|
-
| toolbars | Array<ToolbarNames \| number
|
|
90
|
-
| toolbarsExclude | Array<ToolbarNames \| number
|
|
91
|
-
| noPrettier | boolean | false | Use prettier to beautify content or not |
|
|
92
|
-
| editorId | string | 'md-editor-v3' | Editor id, it is used when there are more than two editors in the same page |
|
|
93
|
-
| tabWidth | number | 2 | One tab eq some spaces |
|
|
94
|
-
| showCodeRowNumber | boolean | false | Show row number for code block or not |
|
|
95
|
-
| previewTheme | 'default' \| 'github' \| 'vuepress' \| 'mk-cute' \| 'smart-blue' \| 'cyanosis' | 'default' |
|
|
96
|
-
| style | string \| CSSProperties | {} |
|
|
97
|
-
| tableShape | [number, number] | [6, 4] | Preset the size of the table, [columns, rows] |
|
|
98
|
-
| noMermaid | boolean | false | Use mermaid or not |
|
|
99
|
-
| placeholder | string | '' | |
|
|
100
|
-
| noKatex | boolean | false | Use katex or not |
|
|
101
|
-
| codeTheme | 'atom' \| 'a11y' \| 'github' \| 'gradient' \| 'kimbie' \| 'paraiso' \| 'qtcreator' \| 'stackoverflow' | 'atom' | Highlight code style, can be customized also |
|
|
102
|
-
| markedHeadingId | (text: string, level: number, index: number) => string | (text) => text | H1-H6 `ID` generator |
|
|
103
|
-
| sanitize | (html: string) => string | (html) => html | Sanitize the html, prevent XSS |
|
|
104
|
-
| footers | Array<'markdownTotal' \| '=' \| 'scrollSwitch' \| number
|
|
105
|
-
| scrollAuto | boolean | true | Scroll default setting |
|
|
106
|
-
| noIconfont | boolean | false | Not append iconfont script, [download](https://at.alicdn.com/t/c/
|
|
107
|
-
| formatCopiedText | (text: string) => string | (text: string) => text | Format copied code |
|
|
108
|
-
| noUploadImg | boolean | false | Not show the entrance to upload pictures |
|
|
80
|
+
| modelValue | `string` | '' | Markdown content, use `v-model` in vue template |
|
|
81
|
+
| theme | `'light' \| 'dark'` | 'light' | Editor theme |
|
|
82
|
+
| class | `string` | '' | |
|
|
83
|
+
| historyLength | `number` | 10 | The max length of history(if it is too big, editor will use more `RAM`) |
|
|
84
|
+
| pageFullscreen | `boolean` | false | Screenfull in web page |
|
|
85
|
+
| preview | `boolean` | true | Preview content in editor |
|
|
86
|
+
| htmlPreview | `boolean` | false | Preview html in editor |
|
|
87
|
+
| previewOnly | `boolean` | false | Only render preview of content, no toolbar, no editing area |
|
|
88
|
+
| language | `string` | 'zh-CN' | Build-in language('zh-CN','en-US') |
|
|
89
|
+
| toolbars | `Array<ToolbarNames \| number>` | [toolbars] | Show contents of toolbar, all keys<sup>see `toolbars` below</sup> |
|
|
90
|
+
| toolbarsExclude | `Array<ToolbarNames \| number>` | [] | Don't show contents of toolbar, all keys`toolbars` |
|
|
91
|
+
| noPrettier | `boolean` | false | Use prettier to beautify content or not |
|
|
92
|
+
| editorId | `string` | 'md-editor-v3' | Editor's id, it is used when there are more than two editors in the same page |
|
|
93
|
+
| tabWidth | `number` | 2 | One tab eq some spaces |
|
|
94
|
+
| showCodeRowNumber | `boolean` | false | Show row number for code block or not |
|
|
95
|
+
| previewTheme | `'default' \| 'github' \| 'vuepress' \| 'mk-cute' \| 'smart-blue' \| 'cyanosis'` | 'default' | Theme of preview, can be customized |
|
|
96
|
+
| style | `string \| CSSProperties` | {} | Inline style |
|
|
97
|
+
| tableShape | `[number, number]` | [6, 4] | Preset the size of the table, [columns, rows] |
|
|
98
|
+
| noMermaid | `boolean` | false | Use mermaid or not |
|
|
99
|
+
| placeholder | `string` | '' | |
|
|
100
|
+
| noKatex | `boolean` | false | Use katex or not |
|
|
101
|
+
| codeTheme | `'atom' \| 'a11y' \| 'github' \| 'gradient' \| 'kimbie' \| 'paraiso' \| 'qtcreator' \| 'stackoverflow'` | 'atom' | Highlight code style, can be customized also |
|
|
102
|
+
| markedHeadingId | `(text: string, level: number, index: number) => string` | (text) => text | H1-H6 `ID` generator |
|
|
103
|
+
| sanitize | `(html: string) => string` | (html) => html | Sanitize the html, prevent XSS |
|
|
104
|
+
| footers | `Array<'markdownTotal' \| '=' \| 'scrollSwitch' \| number>` | ['markdownTotal', '=', 'scrollSwitch'] | Show contents of footer, they are divided by `'='`. Set it to `[]` to hidden footer |
|
|
105
|
+
| scrollAuto | `boolean` | true | Scroll default setting |
|
|
106
|
+
| noIconfont | `boolean` | false | Not append iconfont script, [download](https://at.alicdn.com/t/c/font_2605852_gymddm8qwtd.js) and import it by yourself |
|
|
107
|
+
| formatCopiedText | `(text: string) => string` | (text: string) => text | Format copied code |
|
|
108
|
+
| noUploadImg | `boolean` | false | Not show the entrance to upload pictures |
|
|
109
|
+
| codeStyleReverse | `boolean` | false | Code style will be reversed to dark while code block of the theme has a dark background |
|
|
110
|
+
| codeStyleReverseList | `Array<string>` | ['default', 'mk-cute'] | Themes to be reversed |
|
|
109
111
|
|
|
110
112
|
<details>
|
|
111
|
-
<summary
|
|
113
|
+
<summary>『toolbars』</summary>
|
|
112
114
|
|
|
113
115
|
```js
|
|
114
116
|
[
|
|
@@ -153,7 +155,7 @@ mark and emoji extensions
|
|
|
153
155
|
> After v1.10.0, you can customize the toolbar. To display them, put index of `defToolbars` into `toolbars`(this is not standard), for more usage, please refer to [docs](https://imzbf.github.io/md-editor-v3/docs).
|
|
154
156
|
|
|
155
157
|
<details>
|
|
156
|
-
<summary
|
|
158
|
+
<summary>『StaticTextDefaultValue』</summary>
|
|
157
159
|
|
|
158
160
|
Expand language, you need to replace all the content here:
|
|
159
161
|
|
|
@@ -210,11 +212,12 @@ export interface StaticTextDefaultValue {
|
|
|
210
212
|
};
|
|
211
213
|
// The modal tips of add link or upload picture
|
|
212
214
|
linkModalTips?: {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
linkTitle?: string;
|
|
216
|
+
imageTitle?: string;
|
|
217
|
+
descLabel?: string;
|
|
218
|
+
descLabelPlaceHolder?: string;
|
|
219
|
+
urlLabel?: string;
|
|
220
|
+
urlLabelPlaceHolder?: string;
|
|
218
221
|
buttonOK?: string;
|
|
219
222
|
};
|
|
220
223
|
// The modal tips of clip the picture, v1.2.0
|
|
@@ -252,12 +255,146 @@ export interface StaticTextDefaultValue {
|
|
|
252
255
|
|
|
253
256
|
</details>
|
|
254
257
|
|
|
255
|
-
|
|
258
|
+
## 🤱🏼 Expose
|
|
259
|
+
|
|
260
|
+
After 2.5.0, Editor exposes several methods on the instance, used to get or change the internal status of the editor.
|
|
261
|
+
|
|
262
|
+
```vue
|
|
263
|
+
<template>
|
|
264
|
+
<md-editor ref="editorRef" />
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<script setup>
|
|
268
|
+
import { ref, onMounted } from 'vue';
|
|
269
|
+
import MdEditor from 'md-editor-v3';
|
|
270
|
+
import type { ExposeParam } from 'md-editor-v3';
|
|
271
|
+
|
|
272
|
+
import 'md-editor-v3/lib/style.css';
|
|
273
|
+
|
|
274
|
+
const editorRef = ref<ExposeParam>();
|
|
275
|
+
|
|
276
|
+
onMounted(() => {
|
|
277
|
+
editorRef.value?.on('catalog', console.log);
|
|
278
|
+
|
|
279
|
+
editorRef.value?.toggleCatalog(true);
|
|
280
|
+
});
|
|
281
|
+
</script>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
> Switched to the opposite status, if toggle without input parameter.
|
|
285
|
+
|
|
286
|
+
### 👂🏼 on
|
|
287
|
+
|
|
288
|
+
Get the internal state of the editor, including pageFullscreen, fullscreen, preview, htmlPreview, catalog, etc.
|
|
289
|
+
|
|
290
|
+
- pageFullscreen
|
|
291
|
+
|
|
292
|
+
```js
|
|
293
|
+
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
- fullscreen
|
|
297
|
+
|
|
298
|
+
```js
|
|
299
|
+
editorRef.value?.on('fullscreen', (status) => console.log(status));
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
- preview
|
|
303
|
+
|
|
304
|
+
```js
|
|
305
|
+
editorRef.value?.on('preview', (status) => console.log(status));
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
- htmlPreview
|
|
309
|
+
|
|
310
|
+
```js
|
|
311
|
+
editorRef.value?.on('htmlPreview', (status) => console.log(status));
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
- catalog
|
|
315
|
+
|
|
316
|
+
```js
|
|
317
|
+
editorRef.value?.on('catalog', (status) => console.log(status));
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### 💻 togglePageFullscreen
|
|
321
|
+
|
|
322
|
+
Toggle status of fullscreen within the page.
|
|
323
|
+
|
|
324
|
+
```js
|
|
325
|
+
editorRef.value?.togglePageFullscreen(true);
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### 🖥 toggleFullscreen
|
|
329
|
+
|
|
330
|
+
Toggle status of fullscreen widthin browser.
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
editorRef.value?.toggleFullscreen(true);
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### 📖 togglePreview
|
|
337
|
+
|
|
338
|
+
Toggle status of preview.
|
|
339
|
+
|
|
340
|
+
```js
|
|
341
|
+
editorRef.value?.togglePreview(true);
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### 📼 toggleHtmlPreview
|
|
345
|
+
|
|
346
|
+
Toggle status of htmlPreview.
|
|
347
|
+
|
|
348
|
+
```js
|
|
349
|
+
editorRef.value?.toggleHtmlPreview(true);
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 🧬 toggleCatalog
|
|
353
|
+
|
|
354
|
+
Toggle status of catalog.
|
|
355
|
+
|
|
356
|
+
```js
|
|
357
|
+
editorRef.value?.toggleCatalog(true);
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### 💾 triggerSave
|
|
361
|
+
|
|
362
|
+
```js
|
|
363
|
+
editorRef.value?.triggerSave();
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 💉 insert
|
|
367
|
+
|
|
368
|
+
Manually insert content into textarea.
|
|
369
|
+
|
|
370
|
+
```js
|
|
371
|
+
/**
|
|
372
|
+
* @params selectedText
|
|
373
|
+
*/
|
|
374
|
+
editorRef.value?.insert((selectedText) => {
|
|
375
|
+
/**
|
|
376
|
+
* @return targetValue Content to be inserted
|
|
377
|
+
* @return select Automatically select content
|
|
378
|
+
* @return deviationStart Start position of the selected content
|
|
379
|
+
* @return deviationEnd End position of the selected content
|
|
380
|
+
*/
|
|
381
|
+
return {
|
|
382
|
+
targetValue: `${selectedText}`,
|
|
383
|
+
select: true,
|
|
384
|
+
deviationStart: 0,
|
|
385
|
+
deviationEnd: 0
|
|
386
|
+
};
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
For more examples, refer to source code of [extension component](https://github.com/imzbf/md-editor-v3/blob/dev-docs/src/components/MarkExtension/index.vue)
|
|
391
|
+
|
|
392
|
+
### 🎍 Slots
|
|
256
393
|
|
|
257
394
|
| name | type | default | description |
|
|
258
395
|
| --- | --- | --- | --- |
|
|
259
|
-
| defToolbars | Array<DropdownToolbar \| NormalToolbar \| ModalToolbar
|
|
260
|
-
| defFooters | Array<string \| VNode \| JSX.Element
|
|
396
|
+
| defToolbars | `Array<DropdownToolbar \| NormalToolbar \| ModalToolbar>` | null | Custom toolbar in `DropdownToolbar`, `NormalToolbar` or `ModalToolbar` |
|
|
397
|
+
| defFooters | `Array<string \| VNode \| JSX.Element>` | null | Custom footer |
|
|
261
398
|
|
|
262
399
|
`NormalToolbar` example:
|
|
263
400
|
|
|
@@ -287,7 +424,7 @@ const handler = () => {
|
|
|
287
424
|
</script>
|
|
288
425
|
```
|
|
289
426
|
|
|
290
|
-
### Events
|
|
427
|
+
### 🪢 Events
|
|
291
428
|
|
|
292
429
|
| name | param | description |
|
|
293
430
|
| --- | --- | --- |
|
|
@@ -296,9 +433,9 @@ const handler = () => {
|
|
|
296
433
|
| 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 |
|
|
297
434
|
| onHtmlChanged | `html: string` | Compile markdown successful event, you can use it to get the html code |
|
|
298
435
|
| onGetCatalog | `list: Array<HeadList>` | Get catalog of article |
|
|
299
|
-
| onError | `err: { name: string; message: string }` | Catch run-time error, `Cropper`, `
|
|
436
|
+
| onError | `err: { name: string; message: string }` | Catch run-time error, `Cropper`, `fullscreen` and `prettier` are used when they are not loaded |
|
|
300
437
|
|
|
301
|
-
## Config
|
|
438
|
+
## 💴 Config
|
|
302
439
|
|
|
303
440
|
Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
304
441
|
|
|
@@ -375,7 +512,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
375
512
|
```
|
|
376
513
|
|
|
377
514
|
<details>
|
|
378
|
-
<summary
|
|
515
|
+
<summary>『EditorExtensions』</summary>
|
|
379
516
|
|
|
380
517
|
```ts
|
|
381
518
|
import MdEditor from 'md-editor-v3';
|
|
@@ -419,7 +556,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
419
556
|
|
|
420
557
|
</details>
|
|
421
558
|
|
|
422
|
-
## Shortcut Key
|
|
559
|
+
## 🪡 Shortcut Key
|
|
423
560
|
|
|
424
561
|
| key | function | description |
|
|
425
562
|
| --- | --- | --- |
|
|
@@ -448,11 +585,11 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
448
585
|
| CTRL + ALT + C | code row | |
|
|
449
586
|
| CTRL + SHIFT + ALT + T | table | `\|table\|` |
|
|
450
587
|
|
|
451
|
-
## Components
|
|
588
|
+
## 🪤 Components
|
|
452
589
|
|
|
453
590
|
They are used as attributes of the editor component, eg: `Editor.DropdownToolbar`. For more examples, refer to [document](https://imzbf.github.io/md-editor-v3).
|
|
454
591
|
|
|
455
|
-
### NormalToolbar
|
|
592
|
+
### 🐣 NormalToolbar
|
|
456
593
|
|
|
457
594
|
`Editor.NormalToolbar`
|
|
458
595
|
|
|
@@ -468,7 +605,7 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
468
605
|
|
|
469
606
|
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
470
607
|
|
|
471
|
-
### DropdownToolbar
|
|
608
|
+
### 🐼 DropdownToolbar
|
|
472
609
|
|
|
473
610
|
`Editor.DropdownToolbar`
|
|
474
611
|
|
|
@@ -486,7 +623,7 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
486
623
|
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
487
624
|
- `overlay`: `string | JSX.Element`, necessary, content of dropdown box.
|
|
488
625
|
|
|
489
|
-
### ModalToolbar
|
|
626
|
+
### 🦉 ModalToolbar
|
|
490
627
|
|
|
491
628
|
`Editor.ModalToolbar`
|
|
492
629
|
|
|
@@ -511,7 +648,7 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
511
648
|
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
512
649
|
- `overlay`: `string | JSX.Element`, necessary, content of Modal.
|
|
513
650
|
|
|
514
|
-
### MdCatalog
|
|
651
|
+
### 🐻 MdCatalog
|
|
515
652
|
|
|
516
653
|
`Editor.MdCatalog`
|
|
517
654
|
|
|
@@ -528,9 +665,9 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
528
665
|
|
|
529
666
|
- `onClick`: `(e: MouseEvent, t: TocItem) => void`, not necessary.
|
|
530
667
|
|
|
531
|
-
## Examples
|
|
668
|
+
## 🗂 Examples
|
|
532
669
|
|
|
533
|
-
### Jsx Template
|
|
670
|
+
### 🎸 Jsx Template
|
|
534
671
|
|
|
535
672
|
```js
|
|
536
673
|
import { defineComponent, reactive } from 'vue';
|
|
@@ -549,7 +686,7 @@ export default defineComponent({
|
|
|
549
686
|
});
|
|
550
687
|
```
|
|
551
688
|
|
|
552
|
-
### Upload Picture
|
|
689
|
+
### 🥹 Upload Picture
|
|
553
690
|
|
|
554
691
|
> Tips: When you paste and upload GIF, it will upload a static picture. So you should upload it by file system!
|
|
555
692
|
|
|
@@ -589,7 +726,7 @@ const onUploadImg = async (files, callback) => {
|
|
|
589
726
|
</script>
|
|
590
727
|
```
|
|
591
728
|
|
|
592
|
-
### Change Styles
|
|
729
|
+
### 🧙♂️ Change Styles
|
|
593
730
|
|
|
594
731
|
```less
|
|
595
732
|
.css-vars(@isDark) {
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { HeadList } from './type';
|
|
2
1
|
declare const Editor: import("vue").DefineComponent<{
|
|
3
2
|
modelValue: {
|
|
4
3
|
type: import("vue").PropType<string>;
|
|
@@ -17,15 +16,15 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
17
16
|
default: number;
|
|
18
17
|
};
|
|
19
18
|
onChange: {
|
|
20
|
-
type: import("vue").PropType<(
|
|
19
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
21
20
|
};
|
|
22
21
|
onSave: {
|
|
23
|
-
type: import("vue").PropType<(
|
|
22
|
+
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
24
23
|
};
|
|
25
24
|
onUploadImg: {
|
|
26
|
-
type: import("vue").PropType<(
|
|
25
|
+
type: import("vue").PropType<import("./type").UploadImgEvent>;
|
|
27
26
|
};
|
|
28
|
-
|
|
27
|
+
pageFullscreen: {
|
|
29
28
|
type: import("vue").PropType<boolean>;
|
|
30
29
|
default: boolean;
|
|
31
30
|
};
|
|
@@ -58,10 +57,10 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
58
57
|
default: boolean;
|
|
59
58
|
};
|
|
60
59
|
onHtmlChanged: {
|
|
61
|
-
type: import("vue").PropType<(
|
|
60
|
+
type: import("vue").PropType<import("./type").HtmlChangedEvent>;
|
|
62
61
|
};
|
|
63
62
|
onGetCatalog: {
|
|
64
|
-
type: import("vue").PropType<(
|
|
63
|
+
type: import("vue").PropType<import("./type").GetCatalogEvent>;
|
|
65
64
|
};
|
|
66
65
|
editorId: {
|
|
67
66
|
type: import("vue").PropType<string>;
|
|
@@ -111,7 +110,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
111
110
|
type: import("vue").PropType<string | JSX.Element>;
|
|
112
111
|
};
|
|
113
112
|
onError: {
|
|
114
|
-
type: import("vue").PropType<
|
|
113
|
+
type: import("vue").PropType<import("./type").ErrorEvent>;
|
|
115
114
|
};
|
|
116
115
|
codeTheme: {
|
|
117
116
|
type: import("vue").PropType<string>;
|
|
@@ -138,6 +137,14 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
138
137
|
noUploadImg: {
|
|
139
138
|
type: import("vue").PropType<boolean>;
|
|
140
139
|
};
|
|
140
|
+
codeStyleReverse: {
|
|
141
|
+
type: import("vue").PropType<boolean>;
|
|
142
|
+
default: boolean;
|
|
143
|
+
};
|
|
144
|
+
codeStyleReverseList: {
|
|
145
|
+
type: import("vue").PropType<string[]>;
|
|
146
|
+
default: string[];
|
|
147
|
+
};
|
|
141
148
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onChange" | "onSave" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
142
149
|
modelValue: {
|
|
143
150
|
type: import("vue").PropType<string>;
|
|
@@ -156,15 +163,15 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
156
163
|
default: number;
|
|
157
164
|
};
|
|
158
165
|
onChange: {
|
|
159
|
-
type: import("vue").PropType<(
|
|
166
|
+
type: import("vue").PropType<import("./type").ChangeEvent>;
|
|
160
167
|
};
|
|
161
168
|
onSave: {
|
|
162
|
-
type: import("vue").PropType<(
|
|
169
|
+
type: import("vue").PropType<import("./type").SaveEvent>;
|
|
163
170
|
};
|
|
164
171
|
onUploadImg: {
|
|
165
|
-
type: import("vue").PropType<(
|
|
172
|
+
type: import("vue").PropType<import("./type").UploadImgEvent>;
|
|
166
173
|
};
|
|
167
|
-
|
|
174
|
+
pageFullscreen: {
|
|
168
175
|
type: import("vue").PropType<boolean>;
|
|
169
176
|
default: boolean;
|
|
170
177
|
};
|
|
@@ -197,10 +204,10 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
197
204
|
default: boolean;
|
|
198
205
|
};
|
|
199
206
|
onHtmlChanged: {
|
|
200
|
-
type: import("vue").PropType<(
|
|
207
|
+
type: import("vue").PropType<import("./type").HtmlChangedEvent>;
|
|
201
208
|
};
|
|
202
209
|
onGetCatalog: {
|
|
203
|
-
type: import("vue").PropType<(
|
|
210
|
+
type: import("vue").PropType<import("./type").GetCatalogEvent>;
|
|
204
211
|
};
|
|
205
212
|
editorId: {
|
|
206
213
|
type: import("vue").PropType<string>;
|
|
@@ -250,7 +257,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
250
257
|
type: import("vue").PropType<string | JSX.Element>;
|
|
251
258
|
};
|
|
252
259
|
onError: {
|
|
253
|
-
type: import("vue").PropType<
|
|
260
|
+
type: import("vue").PropType<import("./type").ErrorEvent>;
|
|
254
261
|
};
|
|
255
262
|
codeTheme: {
|
|
256
263
|
type: import("vue").PropType<string>;
|
|
@@ -277,14 +284,22 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
277
284
|
noUploadImg: {
|
|
278
285
|
type: import("vue").PropType<boolean>;
|
|
279
286
|
};
|
|
287
|
+
codeStyleReverse: {
|
|
288
|
+
type: import("vue").PropType<boolean>;
|
|
289
|
+
default: boolean;
|
|
290
|
+
};
|
|
291
|
+
codeStyleReverseList: {
|
|
292
|
+
type: import("vue").PropType<string[]>;
|
|
293
|
+
default: string[];
|
|
294
|
+
};
|
|
280
295
|
}>>, {
|
|
296
|
+
pageFullscreen: boolean;
|
|
281
297
|
preview: boolean;
|
|
282
298
|
htmlPreview: boolean;
|
|
283
299
|
modelValue: string;
|
|
284
300
|
theme: import("./type").Themes;
|
|
285
301
|
class: string;
|
|
286
302
|
historyLength: number;
|
|
287
|
-
pageFullScreen: boolean;
|
|
288
303
|
previewOnly: boolean;
|
|
289
304
|
language: string;
|
|
290
305
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -305,5 +320,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
305
320
|
footers: import("./type").Footers[];
|
|
306
321
|
scrollAuto: boolean;
|
|
307
322
|
formatCopiedText: (text: string) => string;
|
|
323
|
+
codeStyleReverse: boolean;
|
|
324
|
+
codeStyleReverseList: string[];
|
|
308
325
|
}>;
|
|
309
326
|
export default Editor;
|
package/lib/MdEditor/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CodeCss, Config, ConfigOption, Footers, StaticTextDefault } from './type';
|
|
2
2
|
export declare const prefix = "md-editor";
|
|
3
3
|
export declare const iconScriptId = "md-editor-v3";
|
|
4
|
-
export declare const iconfontUrl = "https://at.alicdn.com/t/c/
|
|
4
|
+
export declare const iconfontUrl = "https://at.alicdn.com/t/c/font_2605852_gymddm8qwtd.js";
|
|
5
5
|
export declare const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
6
6
|
export declare const highlightUrl: string;
|
|
7
7
|
export declare const prettierUrl: {
|