md-editor-v3 1.11.13 → 2.0.0-beta.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 CHANGED
@@ -21,9 +21,9 @@ 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, support `defalut`、`vuepress`、`github` styles(not identical).
25
- - `mermaid`(>=1.8.0).
26
- - `katex` mathematical formula(>=1.9.0).
24
+ - Preview themes, `defalut`, `vuepress`, `github`, `cyanosis`, `mk-cute`, `smart-blue` styles(not identical). It can be customized also(Get the demo page).
25
+ - `mermaid`(>=1.8.0), `katex` mathematical formula(>=1.9.0).
26
+ - Customize the toolbar as you like.
27
27
 
28
28
  ## Preview
29
29
 
@@ -31,57 +31,43 @@ Markdown editor for vue3, developed in `jsx` and `typescript`.
31
31
  | --- | --- | --- |
32
32
  | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-light.png) | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-dark.png) | ![](https://imzbf.github.io/md-editor-v3/imgs/preview-previewOnly.png) |
33
33
 
34
+ mark and emoji extensions
35
+
36
+ ![mark and emoji extension](https://imzbf.github.io/md-editor-v3/imgs/mark_emoji.gif)
37
+
34
38
  ## Apis
35
39
 
36
40
  ### Props
37
41
 
38
42
  | name | type | default | description |
39
43
  | --- | --- | --- | --- |
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 | 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 | Object | {key: StaticTextDefaultValue} | Expand language, update `language` api to your key |
44
+ | modelValue | string | '' | Markdown content, use `v-model` in vue template |
45
+ | theme | 'light' \| 'dark' | 'light' | Editor theme |
46
+ | class | string | '' | |
47
+ | historyLength | number | 10 | The max length of history(if it is too big, editor will use more `RAM`) |
48
+ | pageFullScreen | boolean | false | Screenfull in web page |
49
+ | preview | boolean | true | Preview content in editor |
50
+ | htmlPreview | boolean | false | Preview html in editor |
51
+ | previewOnly | boolean | false | Only render article content, no toolbar, no edit area |
52
+ | language | string | 'zh-CN' | Build-in language('zh-CN','en-US') |
53
53
  | toolbars | Array | [toolbars] | Show some item of toolbars, all keys<sup>see `toolbars` below</sup> |
54
54
  | toolbarsExclude | 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 | 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 | 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 | String | [iconfont](https://at.alicdn.com/t/font_2605852_khjf435c7th.js) | Icon url |
61
- | editorId | String | md-editor-v3 | Editor's id, the html's id also, it is used when there are more than two editors in the same page. |
62
- | tabWidth | Number | 2 | One tab eq some spaces |
63
- | showCodeRowNumber | Boolean | false | Show row number for code block or not |
64
- | screenfull | Object | null | Screenfull instance, editor will not insert script of it |
65
- | screenfullJs | String | [screenfull@5.1.0](https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js) | Screenfull js url |
66
- | previewTheme | 'default' \| 'github' \| 'vuepress' | 'default' | Preview themes |
67
- | style | CSSProperties | {} | Editor's inline style |
68
- | tableShape | [Number, Number] | [6, 4] | Preset the size of the table, [columns, rows]. |
69
- | mermaid | Object | undefined | `mermaid` instance |
70
- | mermaidJs | String | [mermaid@8.13.5](https://cdn.jsdelivr.net/npm/mermaid@8.13.5/dist/mermaid.min.js) | MermaidJs url |
71
- | noMermaid | Boolean | false | Do not use mermaid |
72
- | placeholder | String | '' | |
73
- | katex | Object | undefined | `katex` instance(You need import css by yourself) |
74
- | katexJs | String | [katex.min.js@0.15.1](https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js) | KatexJs url |
75
- | katexCss | String | [katex.min.css@0.15.1](https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css) | KatexCss url |
76
- | noKatex | Boolean | false | Do not use katex |
77
- | defToolbars | Array<DropdownToolbar \| NormalToolbar> | 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) |
78
- | extensions | Array | [] | [marked](https://marked.js.org/using_pro#extensions) extensions |
79
-
80
- mark and emoji extensions
81
-
82
- ![mark and Emoji extension](https://imzbf.github.io/md-editor-v3/imgs/mark_emoji.gif)
83
-
84
- [toolbars]
55
+ | noPrettier | boolean | false | Use prettier to beautify content or not |
56
+ | editorId | string | md-editor-v3 | Editor id, it is used when there are more than two editors in the same page. |
57
+ | tabWidth | number | 2 | One tab eq some spaces |
58
+ | showCodeRowNumber | boolean | false | Show row number for code block or not |
59
+ | previewTheme | 'default' \| 'github' \| 'vuepress' \| 'mk-cute' \| 'smart-blue' \| 'cyanosis' | 'default' | Preview theme, can be customized |
60
+ | style | string \| CSSProperties | {} | Editor inline style |
61
+ | tableShape | [number, number] | [6, 4] | Preset the size of the table, [columns, rows] |
62
+ | noMermaid | boolean | false | Use mermaid or not |
63
+ | placeholder | string | '' | |
64
+ | noKatex | boolean | false | Use katex or not |
65
+ | codeCssName | 'atom' \| 'a11y' \| 'github' \| 'gradient' \| 'kimbie' \| 'paraiso' \| 'qtcreator' \| 'stackoverflow' | 'atom' | [Highlight](https://www.jsdelivr.com/package/npm/highlight.js?path=styles) code style, can be customized also |
66
+ | markedHeadingId | (text: string, level: number) => string | (text) => text | H1-H6 `ID` generator |
67
+ | sanitize | (html: string) => string | (html) => html | Sanitize the html, prevent XSS |
68
+
69
+ <details>
70
+ <summary>[toolbars]</summary>
85
71
 
86
72
  ```js
87
73
  [
@@ -118,13 +104,16 @@ mark and emoji extensions
118
104
  ];
119
105
  ```
120
106
 
107
+ </details>
108
+
121
109
  > After v1.6.0, You can sort the toolbar as you like, split tools by `'-'`, the left and right toolbars are divided by `'='`!
122
110
 
123
- > 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]().
111
+ > 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).
124
112
 
125
- Expand language, you need to replace all the content here:
113
+ <details>
114
+ <summary>[StaticTextDefaultValue]</summary>
126
115
 
127
- [StaticTextDefaultValue]
116
+ Expand language, you need to replace all the content here:
128
117
 
129
118
  ```ts
130
119
  export interface ToolbarTips {
@@ -217,101 +206,284 @@ export interface StaticTextDefaultValue {
217
206
  }
218
207
  ```
219
208
 
220
- ### Event
209
+ </details>
221
210
 
222
- | name | params | usage | description |
211
+ ### Slots
212
+
213
+ | name | type | default | description |
223
214
  | --- | --- | --- | --- |
224
- | onChange | v:string | @onChange="xxx" | Content changed event(bind to `oninput` of `textarea`) |
225
- | onSave | v:string | @onSave="xxx" | Save content event, `ctrl+s`and click button will trigger |
226
- | onUploadImg | files:Array<File>, callback:Function | @onUploadImg="xxx" | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
227
- | onHtmlChanged | h:string | @onHtmlChanged="xxx" | Compile markdown successful event, you can use it to get the html code |
228
- | onGetCatalog | list: HeadList[] | @onGetCatalog="xxx" | Get catalogue of article |
229
- | markedHeading | text: string,level: 1-6,raw: string, slugger: Slugger | :marked-heading="xxx" | `marked` head renderer methods |
230
- | markedHeadingId | (text: string, level: number) => string | :marked-heading-id="xxx" | title `ID` generator |
231
- | sanitize | (html: string) => string | :sanitize="xxx" | Sanitize the html, prevent XSS |
232
- | markedImage | (href: string, title: string, desc: string) => string | :marked-image="xxx" | Overrides the html element structure of the default generated picture |
215
+ | 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
+
217
+ `NormalToolbar` component example:
218
+
219
+ ```js
220
+ <template>
221
+ <md-editor>
222
+ <template #defToolbars>
223
+ <normal-toolbar title="mark" @click="handler">
224
+ <template #trigger>
225
+ <svg class="md-icon" aria-hidden="true">
226
+ <use xlink:href="#icon-mark"></use>
227
+ </svg>
228
+ </template>
229
+ </normal-toolbar>
230
+ </template>
231
+ </md-editor>
232
+ </template>
233
+ <script setup>
234
+ import MdEditor from 'md-editor-v3';
233
235
 
234
- > If `markedHeading` is overridden, be sure to tell the editor the algorithm for generating the title ID by `marketheadingid`.
236
+ const NormalToolbar = MdEditor.NormalToolbar;
235
237
 
236
- ### Shortcut key
238
+ const handler = () => { console.log('NormalToolbar clicked!') }
239
+ </script>
240
+ ```
237
241
 
238
- | key | function | description | support |
239
- | --- | --- | --- | --- |
240
- | TAB | insert space | Insert space, the length eq `tabWidth`, default: 2, support multiline | v1.4.0 |
241
- | SHIFT + TAB | delete space, setting is the same as Tab | | v1.4.0 |
242
- | CTRL + C | copy | When selected, copy the selected content. When not selected, copy the content of the current line | v1.4.0 |
243
- | CTRL + X | shear | When selected, cut the selected content. When not selected, cut the current line | v1.4.0 |
244
- | CTRL + D | delete | When selected, delete the selected content. When not selected, delete the current line | v1.4.0 |
245
- | CTRL + S | save | Trigger `onSave` event | v1.0.0 |
246
- | CTRL + B | bold text | `**bold**` | v1.0.0 |
247
- | CTRL + U | underline | `<u>underline</u>` | v1.0.0 |
248
- | CTRL + I | italic | `*italic*` | v1.0.0 |
249
- | CTRL + 1-6 | h1-h6 | `# title` | v1.0.0 |
250
- | CTRL + ↑ | superscript | `<sup>superscript</sup>` | v1.0.0 |
251
- | CTRL + ↓ | subscript | `<sub>subscript</sub>` | v1.0.0 |
252
- | CTRL + Q | quote | `> quote` | v1.0.0 |
253
- | CTRL + O | ordered list | `1. ordered list` | v1.0.0 |
254
- | CTRL + L | link | `[link](https://github.com/imzbf/md-editor-v3)` | v1.0.0 |
255
- | CTRL + Z | withdraw | Withdraw history in editor, not the function of system | v1.0.0 |
256
- | CTRL + SHIFT + S | line-through | `~line-through~` | v1.0.0 |
257
- | CTRL + SHIFT + U | unordered list | `- unordered list` | v1.0.0 |
258
- | CTRL + SHIFT + C | code block | | v1.0.0 |
259
- | CTRL + SHIFT + I | picture | `![picture](https://imbf.cc)` | v1.0.0 |
260
- | CTRL + SHIFT + Z | forward | Forward history in editor, not the function of system | v1.0.0 |
261
- | CTRL + SHIFT + F | Beautify | | v1.0.0 |
262
- | CTRL + ALT + C | code row | | v1.0.0 |
263
- | CTRL + SHIFT + ALT + T | table | `\|table\|` | v1.4.0 |
264
-
265
- ## Internal components
266
-
267
- Before 1.x, 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).
242
+ ### Events
243
+
244
+ | name | param | description |
245
+ | --- | --- | --- |
246
+ | onChange | v:string | Content changed event(bind to `oninput` of `textarea`) |
247
+ | onSave | v:string | Save content event, `ctrl+s`and click button will be triggered also |
248
+ | onUploadImg | files:Array<File>, callback:Function | Upload picture event, when picture is uploading the modal will not close, please provide right urls to the callback function |
249
+ | onHtmlChanged | h:string | Compile markdown successful event, you can use it to get the html code |
250
+ | onGetCatalog | list: HeadList[] | Get catalog of article |
251
+
252
+ ## Config
253
+
254
+ Use `MdEditor.config(option: ConfigOption)` to reconfigure `renderer`.
255
+
256
+ - markedRenderer: `(renderer: Renderer) => Renderer`, 🌰(Open target page in a new browser window):
257
+
258
+ ```js
259
+ MdEditor.config({
260
+ markedRenderer(renderer) {
261
+ renderer.link = (href, title, text) => {
262
+ return `<a href="${href}" title="${title}" target="_blank">${text}</a>`;
263
+ };
264
+
265
+ return renderer;
266
+ }
267
+ });
268
+ ```
269
+
270
+ > Reference: https://marked.js.org/using_pro#renderer
271
+
272
+ - markedExtensions: `Array<marked.TokenizerExtension & marked.RendererExtension>`
273
+
274
+ ```js
275
+ import MdEditor from 'md-editor-v3';
276
+
277
+ MdEditor.config({
278
+ markedExtensions: [your extension]
279
+ });
280
+ ```
281
+
282
+ > Reference: https://marked.js.org/using_pro#extensions
283
+
284
+ - markedOptions: `marked.MarkedOptions`, 🌰(do not render `<br>` on a single line break):
285
+
286
+ ```js
287
+ import MdEditor from 'md-editor-v3';
288
+
289
+ MdEditor.config({
290
+ markedOptions: { breaks: false }
291
+ });
292
+ ```
293
+
294
+ > Reference: https://marked.js.org/using_advanced#options
295
+
296
+ - editorConfig: Add more languages,reset `mermaid` template:
297
+
298
+ ```js
299
+ import MdEditor from 'md-editor-v3';
300
+
301
+ MdEditor.config({
302
+ markedOptions: {
303
+ languageUserDefined: { 'lang': StaticTextDefaultValue };
304
+ mermaidTemplate: {
305
+ flow: `flow tempalte`;
306
+ ...more
307
+ };
308
+ }
309
+ });
310
+ ```
311
+
312
+ - editorExtensions: Config some dependency libraries, like highlight..
313
+
314
+ ```typescript
315
+ import MdEditor from 'md-editor-v3';
316
+
317
+ MdEditor.config({
318
+ editorExtensions: { iconfont: 'https://xxx.cc' }
319
+ });
320
+ ```
321
+
322
+ <details>
323
+ <summary>[EditorExtensions]</summary>
324
+
325
+ ```ts
326
+ import MdEditor from 'md-editor-v3';
327
+
328
+ interface EditorExtensions {
329
+ highlight?: {
330
+ instance?: any;
331
+ js?: string;
332
+ css?: {
333
+ [key: string]: {
334
+ light: string;
335
+ dark: string;
336
+ };
337
+ };
338
+ };
339
+ prettier?: {
340
+ standaloneJs?: string;
341
+ parserMarkdownJs?: string;
342
+ };
343
+ cropper?: {
344
+ instance?: any;
345
+ js?: string;
346
+ css?: string;
347
+ };
348
+ iconfont?: string;
349
+ screenfull?: {
350
+ instance?: any;
351
+ js?: string;
352
+ };
353
+ mermaid?: {
354
+ instance?: any;
355
+ js?: string;
356
+ };
357
+ katex?: {
358
+ instance?: any;
359
+ js?: string;
360
+ css?: string;
361
+ };
362
+ }
363
+ ```
364
+
365
+ </details>
366
+
367
+ ## Shortcut key
368
+
369
+ | key | function | description |
370
+ | --- | --- | --- |
371
+ | TAB | insert space | Insert space, the length eq `tabWidth`, default: 2, support multiline |
372
+ | SHIFT + TAB | delete space, setting is the same as Tab | |
373
+ | CTRL + C | copy | When selected, copy the selected content. When not selected, copy the content of the current line |
374
+ | CTRL + X | shear | When selected, cut the selected content. When not selected, cut the current line |
375
+ | CTRL + D | delete | When selected, delete the selected content. When not selected, delete the current line |
376
+ | CTRL + S | save | Trigger `onSave` event |
377
+ | CTRL + B | bold text | `**bold**` |
378
+ | CTRL + U | underline | `<u>underline</u>` |
379
+ | CTRL + I | italic | `*italic*` |
380
+ | CTRL + 1-6 | h1-h6 | `# title` |
381
+ | CTRL + ↑ | superscript | `<sup>superscript</sup>` |
382
+ | CTRL + ↓ | subscript | `<sub>subscript</sub>` |
383
+ | CTRL + Q | quote | `> quote` |
384
+ | CTRL + O | ordered list | `1. ordered list` |
385
+ | CTRL + L | link | `[link](https://github.com/imzbf/md-editor-v3)` |
386
+ | CTRL + Z | withdraw | Withdraw history in editor, not the function of system |
387
+ | CTRL + SHIFT + S | line-through | `~line-through~` |
388
+ | CTRL + SHIFT + U | unordered list | `- unordered list` |
389
+ | CTRL + SHIFT + C | code block | |
390
+ | CTRL + SHIFT + I | picture | `![picture](https://imbf.cc)` |
391
+ | CTRL + SHIFT + Z | forward | Forward history in editor, not the function of system |
392
+ | CTRL + SHIFT + F | Beautify | |
393
+ | CTRL + ALT + C | code row | |
394
+ | CTRL + SHIFT + ALT + T | table | `\|table\|` |
395
+
396
+ ## Components
397
+
398
+ 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).
268
399
 
269
400
  ### NormalToolbar
270
401
 
271
402
  `Editor.NormalToolbar`
272
403
 
273
- - `title`: `string`, not necessary, the tips when hover toolbar;
274
- - `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar;
275
- - `onClick`: `(e: MouseEvent) => void`, necessary.
404
+ - **props**
405
+
406
+ - `title`: `string`, not necessary, title of toolbar.
407
+
408
+ - **events**
409
+
410
+ - `onClick`: `(e: MouseEvent) => void`, necessary.
411
+
412
+ - **slots**
413
+
414
+ - `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
276
415
 
277
416
  ### DropdownToolbar
278
417
 
279
418
  `Editor.DropdownToolbar`
280
419
 
281
- - `title`: `string`, not necessary, the tips when hover toolbar;
282
- - `visible`: `boolean`, necessary;
283
- - `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar;
284
- - `onChange`: `(visible: boolean) => void`, necessary;
285
- - `overlay`: `string | JSX.Element`, necessary, contents in the drop-down box.
420
+ - **props**
421
+
422
+ - `title`: `string`, not necessary, title of toolbar.
423
+ - `visible`: `boolean`, necessary.
424
+
425
+ - **events**
426
+
427
+ - `onChange`: `(visible: boolean) => void`, necessary.
428
+
429
+ - **slots**
430
+
431
+ - `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
432
+ - `overlay`: `string | JSX.Element`, necessary, content of dropdown box.
433
+
434
+ ### ModalToolbar
435
+
436
+ `Editor.ModalToolbar`
437
+
438
+ - **props**
439
+
440
+ - `title`: `string`, not necessary, title of toolbar.
441
+ - `modalTitle`: `string`, not necessary, title of the Modal.
442
+ - `visible`: `boolean`, necessary, visibility of Modal.
443
+ - `width`: `string`, not necessary, width of Modal, default `auto`.
444
+ - `height`:`string`, same as `width`.
445
+ - `showAdjust`: `boolean`, not necessary, visibility of fullscreen button.
446
+ - `isFullscreen`: `boolean`, necessary when `showAdjust = true`, status of fullscreen.
286
447
 
287
- ### Catalogue
448
+ - **events**
288
449
 
289
- `Editor.Catalog`
450
+ - `onClick`: `() => void`, necessary.
451
+ - `onClose`:`() => void`, necessary, close event.
452
+ - `onAdjust`:`(val: boolean) => void`, fullscreen button click event.
290
453
 
291
- - `editorId`: `string`, necessary, editor's `editorId`, used to register listening events;
292
- - `class`: `string`, not necessary;
293
- - `markedHeadingId`: `MarkedHeadingId`, not necessary, same as editor;
294
- - `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
295
- - `theme`: 'light' | 'dark', not necessary, provide it when you want to change theme online, it is the same as Editor `theme`.
454
+ - **slots**
296
455
 
297
- ## Some examples
456
+ - `trigger`: `string | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
457
+ - `overlay`: `string | JSX.Element`, necessary, content of Modal.
458
+
459
+ ### Catalog
460
+
461
+ `Editor.MdCatalog`
462
+
463
+ - **props**
464
+
465
+ - `editorId`: `string`, necessary, same as editor's `editorId`, used to register listening events.
466
+ - `class`: `string`, not necessary.
467
+ - `markedHeadingId`: `MarkedHeadingId`, not necessary, same as editor.
468
+ - `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
469
+ - `theme`: `'light' | 'dark'`, not necessary, provide it when you want to change theme online, it is the same as Editor `theme`.
470
+
471
+ ## Examples
298
472
 
299
473
  ### Jsx module
300
474
 
301
475
  ```js
302
476
  import { defineComponent, reactive } from 'vue';
303
- import Editor from 'md-editor-v3';
477
+ import MdEditor from 'md-editor-v3';
304
478
  import 'md-editor-v3/lib/style.css';
305
- import hljs from 'highlight.js';
306
- import 'highlight.js/styles/atom-one-dark.css';
307
479
 
308
480
  export default defineComponent({
309
481
  setup() {
310
482
  const md = reactive({
311
- text: 'default markdown content'
483
+ text: '# Hello Editor'
312
484
  });
313
485
  return () => (
314
- <Editor hljs={hljs} modelValue={md.text} onChange={(value) => (md.text = value)} />
486
+ <MdEditor modelValue={md.text} onChange={(value) => (md.text = value)} />
315
487
  );
316
488
  }
317
489
  });
@@ -321,25 +493,16 @@ export default defineComponent({
321
493
 
322
494
  ```js
323
495
  <template>
324
- <editor v-model="text" pageFullScreen></editor>
496
+ <md-editor v-model="text" pageFullScreen></md-editor>
325
497
  </template>
326
498
 
327
- <script>
328
- import { defineComponent } from 'vue';
329
- import Editor from 'md-editor-v3';
499
+ <script setup>
500
+ import { ref } from 'vue';
501
+ import MdEditor from 'md-editor-v3';
330
502
  import 'md-editor-v3/lib/style.css';
331
503
 
332
- export default defineComponent({
333
- name: 'VueTemplateDemo',
334
- components: { Editor },
335
- data() {
336
- return {
337
- text: '# md-editor-v3'
338
- };
339
- }
340
- });
504
+ const text = ref('# Hello Editor')
341
505
  </script>
342
-
343
506
  ```
344
507
 
345
508
  ### Upload picture