md-editor-v3 2.0.0-beta.9 → 2.0.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/LICENSE +1 -1
- package/README.md +63 -21
- package/lib/MdEditor/Editor.d.ts +4 -4
- package/lib/MdEditor/index.d.ts +11 -11
- package/lib/md-editor-v3.es.js +108 -115
- package/lib/md-editor-v3.umd.js +55 -55
- package/lib/style.css +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ English \| [中文](https://github.com/imzbf/md-editor-v3/blob/dev/README-CN.md)
|
|
|
6
6
|
|
|
7
7
|
Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
8
8
|
|
|
9
|
-
- Documentation and example
|
|
9
|
+
- Documentation and example: [Go](https://imzbf.github.io/md-editor-v3)
|
|
10
10
|
|
|
11
|
-
- Use it online
|
|
11
|
+
- Use it online: [Go](https://codesandbox.io/s/epic-bird-2znqo)
|
|
12
12
|
|
|
13
|
-
- The same series editor for react
|
|
13
|
+
- The same series editor for react: [md-editor-rt](https://github.com/imzbf/md-editor-rt)
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
|
21
21
|
- Multi-language, build-in Chinese and English(default: Chinese).
|
|
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
|
-
- Preview themes, `defalut`, `vuepress`, `github`, `cyanosis`, `mk-cute`, `smart-blue` styles(not identical). It can be customized also(
|
|
24
|
+
- Preview themes, `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
|
|
|
@@ -113,7 +113,7 @@ mark and emoji extensions
|
|
|
113
113
|
<details>
|
|
114
114
|
<summary>[StaticTextDefaultValue]</summary>
|
|
115
115
|
|
|
116
|
-
Expand language, you need to replace all the content here
|
|
116
|
+
Expand language, you need to replace all the content here:
|
|
117
117
|
|
|
118
118
|
```ts
|
|
119
119
|
export interface ToolbarTips {
|
|
@@ -213,15 +213,15 @@ export interface StaticTextDefaultValue {
|
|
|
213
213
|
|
|
214
214
|
| name | type | default | description |
|
|
215
215
|
| --- | --- | --- | --- |
|
|
216
|
-
| defToolbars | Array<DropdownToolbar \| NormalToolbar \| ModalToolbar> | null |
|
|
216
|
+
| defToolbars | Array<DropdownToolbar \| NormalToolbar \| ModalToolbar> | null | Custom toolbar in `DropdownToolbar`, `NormalToolbar` or `ModalToolbar` |
|
|
217
217
|
|
|
218
|
-
`NormalToolbar`
|
|
218
|
+
`NormalToolbar` example:
|
|
219
219
|
|
|
220
220
|
```vue
|
|
221
221
|
<template>
|
|
222
222
|
<md-editor>
|
|
223
223
|
<template #defToolbars>
|
|
224
|
-
<normal-toolbar title="mark" @
|
|
224
|
+
<normal-toolbar title="mark" @onClick="handler">
|
|
225
225
|
<template #trigger>
|
|
226
226
|
<svg class="md-icon" aria-hidden="true">
|
|
227
227
|
<use xlink:href="#icon-mark"></use>
|
|
@@ -258,7 +258,9 @@ const handler = () => {
|
|
|
258
258
|
|
|
259
259
|
Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
260
260
|
|
|
261
|
-
- markedRenderer: `(renderer: Renderer) => Renderer
|
|
261
|
+
- markedRenderer: `(renderer: Renderer) => Renderer`
|
|
262
|
+
|
|
263
|
+
Open target page in a new browser window:
|
|
262
264
|
|
|
263
265
|
```js
|
|
264
266
|
MdEditor.config({
|
|
@@ -286,7 +288,9 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
286
288
|
|
|
287
289
|
> Reference: https://marked.js.org/using_pro#extensions
|
|
288
290
|
|
|
289
|
-
- markedOptions: `marked.MarkedOptions
|
|
291
|
+
- markedOptions: `marked.MarkedOptions`
|
|
292
|
+
|
|
293
|
+
Do not render `<br>` on a single line break:
|
|
290
294
|
|
|
291
295
|
```js
|
|
292
296
|
import MdEditor from 'md-editor-v3';
|
|
@@ -298,7 +302,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
298
302
|
|
|
299
303
|
> Reference: https://marked.js.org/using_advanced#options
|
|
300
304
|
|
|
301
|
-
- editorConfig: Add more languages
|
|
305
|
+
- editorConfig: Add more languages, reset `mermaid` template or delay rendering time:
|
|
302
306
|
|
|
303
307
|
```js
|
|
304
308
|
import MdEditor from 'md-editor-v3';
|
|
@@ -371,7 +375,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
371
375
|
|
|
372
376
|
</details>
|
|
373
377
|
|
|
374
|
-
## Shortcut
|
|
378
|
+
## Shortcut Key
|
|
375
379
|
|
|
376
380
|
| key | function | description |
|
|
377
381
|
| --- | --- | --- |
|
|
@@ -394,7 +398,7 @@ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
|
|
|
394
398
|
| CTRL + SHIFT + S | line-through | `~line-through~` |
|
|
395
399
|
| CTRL + SHIFT + U | unordered list | `- unordered list` |
|
|
396
400
|
| CTRL + SHIFT + C | code block | |
|
|
397
|
-
| CTRL + SHIFT + I | picture | `` |
|
|
398
402
|
| CTRL + SHIFT + Z | forward | Forward history in editor, not the function of system |
|
|
399
403
|
| CTRL + SHIFT + F | Beautify | |
|
|
400
404
|
| CTRL + ALT + C | code row | |
|
|
@@ -448,22 +452,22 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
448
452
|
- `modalTitle`: `string`, not necessary, title of the Modal.
|
|
449
453
|
- `visible`: `boolean`, necessary, visibility of Modal.
|
|
450
454
|
- `width`: `string`, not necessary, width of Modal, default `auto`.
|
|
451
|
-
- `height
|
|
455
|
+
- `height`: `string`, same as `width`.
|
|
452
456
|
- `showAdjust`: `boolean`, not necessary, visibility of fullscreen button.
|
|
453
457
|
- `isFullscreen`: `boolean`, necessary when `showAdjust = true`, status of fullscreen.
|
|
454
458
|
|
|
455
459
|
- **events**
|
|
456
460
|
|
|
457
461
|
- `onClick`: `() => void`, necessary.
|
|
458
|
-
- `onClose
|
|
459
|
-
- `onAdjust
|
|
462
|
+
- `onClose`: `() => void`, necessary, close event.
|
|
463
|
+
- `onAdjust`: `(val: boolean) => void`, fullscreen button click event.
|
|
460
464
|
|
|
461
465
|
- **slots**
|
|
462
466
|
|
|
463
467
|
- `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
464
468
|
- `overlay`: `string | JSX.Element`, necessary, content of Modal.
|
|
465
469
|
|
|
466
|
-
###
|
|
470
|
+
### MdCatalog
|
|
467
471
|
|
|
468
472
|
`Editor.MdCatalog`
|
|
469
473
|
|
|
@@ -477,7 +481,7 @@ They are used as attributes of the editor component, eg: `Editor.DropdownToolbar
|
|
|
477
481
|
|
|
478
482
|
## Examples
|
|
479
483
|
|
|
480
|
-
### Jsx
|
|
484
|
+
### Jsx Template
|
|
481
485
|
|
|
482
486
|
```js
|
|
483
487
|
import { defineComponent, reactive } from 'vue';
|
|
@@ -496,7 +500,7 @@ export default defineComponent({
|
|
|
496
500
|
});
|
|
497
501
|
```
|
|
498
502
|
|
|
499
|
-
###
|
|
503
|
+
### Setup Template
|
|
500
504
|
|
|
501
505
|
```vue
|
|
502
506
|
<template>
|
|
@@ -512,10 +516,11 @@ const text = ref('# Hello Editor');
|
|
|
512
516
|
</script>
|
|
513
517
|
```
|
|
514
518
|
|
|
515
|
-
### Upload
|
|
519
|
+
### Upload Picture
|
|
516
520
|
|
|
517
|
-
> Tips
|
|
521
|
+
> Tips: When you paste and upload GIF, it will upload a static picture. So you should upload it by file system!
|
|
518
522
|
|
|
523
|
+
```vue
|
|
519
524
|
<template>
|
|
520
525
|
<md-editor v-model="text" @onUploadImg="onUploadImg" />
|
|
521
526
|
</template>
|
|
@@ -549,3 +554,40 @@ const onUploadImg = async (files, callback) => {
|
|
|
549
554
|
callback(res.map((item) => item.data.url));
|
|
550
555
|
};
|
|
551
556
|
</script>
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### Change Styles
|
|
560
|
+
|
|
561
|
+
```less
|
|
562
|
+
.css-vars(@isDark) {
|
|
563
|
+
--md-color: if(@isDark, #999, #222);
|
|
564
|
+
--md-hover-color: if(@isDark, #bbb, #000);
|
|
565
|
+
--md-bk-color: if(@isDark, #000, #fff);
|
|
566
|
+
--md-bk-color-outstand: if(@isDark, #111, #f6f6f6);
|
|
567
|
+
--md-bk-hover-color: if(@isDark, #1b1a1a, #f5f7fa);
|
|
568
|
+
--md-border-color: if(@isDark, #2d2d2d, #e6e6e6);
|
|
569
|
+
--md-border-hover-color: if(@isDark, #636262, #b9b9b9);
|
|
570
|
+
--md-border-active-color: if(@isDark, #777, #999);
|
|
571
|
+
--md-modal-mask: #00000073;
|
|
572
|
+
--md-scrollbar-bg-color: if(@isDark, #0f0f0f, #e2e2e2);
|
|
573
|
+
--md-scrollbar-thumb-color: if(@isDark, #2d2d2d, #0000004d);
|
|
574
|
+
--md-scrollbar-thumb-hover-color: if(@isDark, #3a3a3a, #00000059);
|
|
575
|
+
--md-scrollbar-thumb-avtive-color: if(@isDark, #3a3a3a, #00000061);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.md {
|
|
579
|
+
.css-vars(false);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.md-dark {
|
|
583
|
+
.css-vars(true);
|
|
584
|
+
}
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
Change background color in dark mode:
|
|
588
|
+
|
|
589
|
+
```css
|
|
590
|
+
.md-dark {
|
|
591
|
+
--md-bk-color: #333 !important;
|
|
592
|
+
}
|
|
593
|
+
```
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -119,7 +119,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
119
119
|
type: PropType<string>;
|
|
120
120
|
default: string;
|
|
121
121
|
};
|
|
122
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "
|
|
122
|
+
}, () => 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
123
|
modelValue: {
|
|
124
124
|
type: PropType<string>;
|
|
125
125
|
default: string;
|
|
@@ -238,20 +238,20 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
238
238
|
default: string;
|
|
239
239
|
};
|
|
240
240
|
}>>, {
|
|
241
|
-
|
|
241
|
+
pageFullScreen: boolean;
|
|
242
242
|
preview: boolean;
|
|
243
243
|
htmlPreview: boolean;
|
|
244
|
+
editorId: string;
|
|
245
|
+
noPrettier: boolean;
|
|
244
246
|
tabWidth: number;
|
|
245
247
|
theme: Themes;
|
|
246
248
|
historyLength: number;
|
|
247
249
|
previewOnly: boolean;
|
|
248
250
|
showCodeRowNumber: boolean;
|
|
249
251
|
previewTheme: string;
|
|
250
|
-
noPrettier: boolean;
|
|
251
252
|
style: string | CSSProperties;
|
|
252
253
|
class: string;
|
|
253
254
|
modelValue: string;
|
|
254
|
-
pageFullScreen: boolean;
|
|
255
255
|
language: string;
|
|
256
256
|
toolbars: ToolbarNames[];
|
|
257
257
|
toolbarsExclude: ToolbarNames[];
|
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -9,20 +9,20 @@ declare const _default: {
|
|
|
9
9
|
$: import("vue").ComponentInternalInstance;
|
|
10
10
|
$data: {};
|
|
11
11
|
$props: Partial<{
|
|
12
|
-
|
|
12
|
+
pageFullScreen: boolean;
|
|
13
13
|
preview: boolean;
|
|
14
14
|
htmlPreview: boolean;
|
|
15
|
+
editorId: string;
|
|
16
|
+
noPrettier: boolean;
|
|
15
17
|
tabWidth: number;
|
|
16
18
|
theme: import("./type").Themes;
|
|
17
19
|
historyLength: number;
|
|
18
20
|
previewOnly: boolean;
|
|
19
21
|
showCodeRowNumber: boolean;
|
|
20
22
|
previewTheme: string;
|
|
21
|
-
noPrettier: boolean;
|
|
22
23
|
style: string | import("vue").CSSProperties;
|
|
23
24
|
class: string;
|
|
24
25
|
modelValue: string;
|
|
25
|
-
pageFullScreen: boolean;
|
|
26
26
|
language: string;
|
|
27
27
|
toolbars: import("./type").ToolbarNames[];
|
|
28
28
|
toolbarsExclude: import("./type").ToolbarNames[];
|
|
@@ -151,7 +151,7 @@ declare const _default: {
|
|
|
151
151
|
type: import("vue").PropType<string>;
|
|
152
152
|
default: string;
|
|
153
153
|
};
|
|
154
|
-
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "
|
|
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">;
|
|
155
155
|
$attrs: {
|
|
156
156
|
[x: string]: unknown;
|
|
157
157
|
};
|
|
@@ -284,20 +284,20 @@ declare const _default: {
|
|
|
284
284
|
default: string;
|
|
285
285
|
};
|
|
286
286
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
|
|
287
|
-
|
|
287
|
+
pageFullScreen: boolean;
|
|
288
288
|
preview: boolean;
|
|
289
289
|
htmlPreview: boolean;
|
|
290
|
+
editorId: string;
|
|
291
|
+
noPrettier: boolean;
|
|
290
292
|
tabWidth: number;
|
|
291
293
|
theme: import("./type").Themes;
|
|
292
294
|
historyLength: number;
|
|
293
295
|
previewOnly: boolean;
|
|
294
296
|
showCodeRowNumber: boolean;
|
|
295
297
|
previewTheme: string;
|
|
296
|
-
noPrettier: boolean;
|
|
297
298
|
style: string | import("vue").CSSProperties;
|
|
298
299
|
class: string;
|
|
299
300
|
modelValue: string;
|
|
300
|
-
pageFullScreen: boolean;
|
|
301
301
|
language: string;
|
|
302
302
|
toolbars: import("./type").ToolbarNames[];
|
|
303
303
|
toolbarsExclude: import("./type").ToolbarNames[];
|
|
@@ -568,21 +568,21 @@ declare const _default: {
|
|
|
568
568
|
type: import("vue").PropType<string>;
|
|
569
569
|
default: string;
|
|
570
570
|
};
|
|
571
|
-
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "
|
|
572
|
-
|
|
571
|
+
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", {
|
|
572
|
+
pageFullScreen: boolean;
|
|
573
573
|
preview: boolean;
|
|
574
574
|
htmlPreview: boolean;
|
|
575
|
+
editorId: string;
|
|
576
|
+
noPrettier: boolean;
|
|
575
577
|
tabWidth: number;
|
|
576
578
|
theme: import("./type").Themes;
|
|
577
579
|
historyLength: number;
|
|
578
580
|
previewOnly: boolean;
|
|
579
581
|
showCodeRowNumber: boolean;
|
|
580
582
|
previewTheme: string;
|
|
581
|
-
noPrettier: boolean;
|
|
582
583
|
style: string | import("vue").CSSProperties;
|
|
583
584
|
class: string;
|
|
584
585
|
modelValue: string;
|
|
585
|
-
pageFullScreen: boolean;
|
|
586
586
|
language: string;
|
|
587
587
|
toolbars: import("./type").ToolbarNames[];
|
|
588
588
|
toolbarsExclude: import("./type").ToolbarNames[];
|