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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 imbf.cc
3
+ Copyright (c) 2021 imzbf.cc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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:[Go](https://imzbf.github.io/md-editor-v3)
9
+ - Documentation and example: [Go](https://imzbf.github.io/md-editor-v3)
10
10
 
11
- - Use it online:[Go](https://codesandbox.io/s/epic-bird-2znqo)
11
+ - Use it online: [Go](https://codesandbox.io/s/epic-bird-2znqo)
12
12
 
13
- - The same series editor for react:[md-editor-rt](https://github.com/imzbf/md-editor-rt)
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(Get the demo page).
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 | Customize Toolbar, for more usage, please refer to [docs](https://imzbf.github.io/md-editor-v3/docs/index#%F0%9F%92%AA%20defToolbars) and [emoji](https://imzbf.github.io/md-editor-v3/demo/index#💪%20Customize%20Toolbar) |
216
+ | defToolbars | Array<DropdownToolbar \| NormalToolbar \| ModalToolbar> | null | Custom toolbar in `DropdownToolbar`, `NormalToolbar` or `ModalToolbar` |
217
217
 
218
- `NormalToolbar` component example:
218
+ `NormalToolbar` example:
219
219
 
220
220
  ```vue
221
221
  <template>
222
222
  <md-editor>
223
223
  <template #defToolbars>
224
- <normal-toolbar title="mark" @click="handler">
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`, 🌰(Open target page in a new browser window):
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`, 🌰(do not render `<br>` on a single line break):
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,reset `mermaid` template:
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 key
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 | `![picture](https://imbf.cc)` |
401
+ | CTRL + SHIFT + I | picture | `![picture](https://imzbf.cc)` |
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`:`string`, same as `width`.
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`:`() => void`, necessary, close event.
459
- - `onAdjust`:`(val: boolean) => void`, fullscreen button click event.
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
- ### Catalog
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 module
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
- ### Vue template
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 picture
519
+ ### Upload Picture
516
520
 
517
- > Tips:When you paste and upload GIF, it will upload a static picture. So you should upload it by file system!
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
+ ```
@@ -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" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
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
- editorId: string;
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[];
@@ -9,20 +9,20 @@ declare const _default: {
9
9
  $: import("vue").ComponentInternalInstance;
10
10
  $data: {};
11
11
  $props: Partial<{
12
- editorId: string;
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, "editorId" | "preview" | "htmlPreview" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "noPrettier" | "style" | "class" | "modelValue" | "pageFullScreen" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "sanitize" | "placeholder" | "noKatex" | "codeTheme">;
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
- editorId: string;
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" | "onChange" | "onUploadImg" | "onHtmlChanged" | "onGetCatalog" | "onError", {
572
- editorId: string;
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[];