vditor 4.0.2-alpha.6 → 4.0.2-alpha.8
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 +69 -5
- package/dist/index.css +35 -29
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6485 -5445
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +17599 -0
- package/dist/js/graphviz/LICENSE.expat +21 -0
- package/dist/js/graphviz/LICENSE.graphviz +277 -0
- package/dist/js/graphviz/LICENSE.viz +21 -0
- package/dist/js/graphviz/README.md +10 -0
- package/dist/js/graphviz/viz.js +6 -330
- package/dist/js/lute/lute.min.js +21 -19
- package/dist/method.d.ts +2 -2
- package/dist/method.js +2017 -1903
- package/dist/method.min.js +1 -1
- package/dist/method.mjs +3243 -0
- package/dist/ts/constants.d.ts +2 -0
- package/dist/ts/ir/index.d.ts +1 -0
- package/dist/ts/markdown/mathRender.d.ts +24 -1
- package/dist/ts/markdown/outlineRender.d.ts +2 -1
- package/dist/ts/markdown/plantumlRender.d.ts +1 -1
- package/dist/ts/outline/index.d.ts +2 -0
- package/dist/ts/sv/index.d.ts +1 -0
- package/dist/ts/tip/index.d.ts +6 -1
- package/dist/ts/undo/index.d.ts +1 -0
- package/dist/ts/upload/linkToImg.d.ts +1 -0
- package/dist/ts/util/addScript.d.ts +1 -2
- package/dist/ts/util/compatibility.d.ts +1 -1
- package/dist/ts/util/expandHTMLTags.d.ts +1 -0
- package/dist/ts/util/imageDrag.d.ts +1 -0
- package/dist/ts/util/notifyConfigChange.d.ts +1 -0
- package/dist/ts/util/pairedSymbols.d.ts +5 -0
- package/dist/ts/util/pasteIntoTable.d.ts +6 -0
- package/dist/ts/util/pasteLink.d.ts +1 -0
- package/dist/ts/util/processCode.d.ts +1 -0
- package/dist/ts/util/tableWheel.d.ts +1 -0
- package/dist/ts/util/taskNavigation.d.ts +1 -0
- package/dist/ts/wysiwyg/index.d.ts +1 -0
- package/dist/types/index.d.ts +56 -1
- package/package.json +3 -2
- package/src/assets/less/_hint.less +6 -0
- package/src/assets/less/_reset.less +29 -0
- package/src/assets/less/_tooltipped.less +2 -2
- package/src/assets/less/_wysiwyg.less +4 -0
- package/src/index.ts +28 -6
- package/src/ts/constants.ts +4 -0
- package/src/ts/ir/expandMarker.ts +3 -0
- package/src/ts/ir/index.ts +11 -1
- package/src/ts/ir/process.ts +3 -0
- package/src/ts/markdown/chartRender.ts +28 -2
- package/src/ts/markdown/graphvizRender.ts +51 -39
- package/src/ts/markdown/highlightRender.ts +6 -2
- package/src/ts/markdown/mathRender.ts +26 -38
- package/src/ts/markdown/mediaRender.ts +1 -1
- package/src/ts/markdown/mermaidRender.ts +4 -3
- package/src/ts/markdown/outlineRender.ts +44 -15
- package/src/ts/markdown/plantumlRender.ts +24 -5
- package/src/ts/markdown/previewRender.ts +5 -1
- package/src/ts/markdown/setLute.ts +1 -0
- package/src/ts/outline/index.ts +72 -0
- package/src/ts/preview/index.ts +1 -1
- package/src/ts/sv/index.ts +1 -0
- package/src/ts/sv/process.ts +3 -0
- package/src/ts/tip/index.ts +25 -9
- package/src/ts/toolbar/CodeTheme.ts +2 -0
- package/src/ts/toolbar/ContentTheme.ts +2 -0
- package/src/ts/toolbar/EditMode.ts +4 -0
- package/src/ts/toolbar/Headings.ts +4 -6
- package/src/ts/toolbar/Outline.ts +2 -0
- package/src/ts/toolbar/Record.ts +5 -0
- package/src/ts/ui/initUI.ts +9 -1
- package/src/ts/ui/setPreviewMode.ts +2 -0
- package/src/ts/undo/index.ts +14 -4
- package/src/ts/upload/index.ts +1 -1
- package/src/ts/upload/linkToImg.ts +91 -0
- package/src/ts/util/Options.ts +2 -0
- package/src/ts/util/addScript.ts +15 -24
- package/src/ts/util/compatibility.ts +2 -2
- package/src/ts/util/editorCommonEvent.ts +47 -4
- package/src/ts/util/expandHTMLTags.ts +36 -0
- package/src/ts/util/fixBrowserBehavior.ts +29 -61
- package/src/ts/util/imageDrag.ts +108 -0
- package/src/ts/util/notifyConfigChange.ts +16 -0
- package/src/ts/util/pairedSymbols.ts +109 -0
- package/src/ts/util/pasteIntoTable.ts +136 -0
- package/src/ts/util/pasteLink.ts +51 -0
- package/src/ts/util/processCode.ts +33 -8
- package/src/ts/util/selection.ts +11 -2
- package/src/ts/util/tableWheel.ts +31 -0
- package/src/ts/util/taskNavigation.ts +113 -0
- package/src/ts/util/toc.ts +9 -3
- package/src/ts/wysiwyg/afterRenderEvent.ts +3 -0
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +5 -4
- package/src/ts/wysiwyg/index.ts +17 -6
- package/src/ts/wysiwyg/setHeading.ts +4 -0
- package/dist/js/graphviz/full.render.js +0 -90
package/README.md
CHANGED
|
@@ -57,6 +57,9 @@ Vditor 在这些方面做了努力,希望能为现代化的通用 Markdown 编
|
|
|
57
57
|
## ✨ 特性
|
|
58
58
|
|
|
59
59
|
* 支持三种编辑模式:所见即所得(wysiwyg)、即时渲染(ir)、分屏预览(sv)
|
|
60
|
+
* 选中文本后输入引号、反引号或左括号可包裹所选内容,支持中英文配对符号及撤销重做
|
|
61
|
+
* 光标位于空的配对符号中间时,Backspace 或 Delete 可同时删除两侧符号,支持括号、引号、反引号及空的 `*`、`~`、`$` 对
|
|
62
|
+
* 鼠标悬停在横向溢出的表格中时,普通滚轮可横向滚动表格;到达边界后继续滚动页面,保留触控板横向滚动及浏览器缩放操作
|
|
60
63
|
* 支持大纲、数学公式、脑图、图表、流程图、甘特图、时序图、数字波形图、五线谱、[多媒体](https://ld246.com/article/1589813914768)、语音阅读、标题锚点、代码高亮及复制、graphviz 渲染、[plantuml](https://plantuml.com)UML图
|
|
61
64
|
* 导出、图片懒加载、任务列表、多平台预览、多主题切换、复制到微信公众号/知乎功能
|
|
62
65
|
* 实现 CommonMark 和 GFM 规范,可对 Markdown 进行格式化和语法树查看,并支持[10+项](https://ld246.com/article/1549638745630#options-preview-markdown)配置
|
|
@@ -66,6 +69,7 @@ Vditor 在这些方面做了努力,希望能为现代化的通用 Markdown 编
|
|
|
66
69
|
* 实时保存内容,防止意外丢失
|
|
67
70
|
* 录音支持,用户可直接发布语音
|
|
68
71
|
* 粘贴 HTML 自动转换为 Markdown,如粘贴中包含外链图片可通过指定接口上传到服务器
|
|
72
|
+
* 在普通文本位置粘贴单个网址时自动生成链接,使用选中文字或网址本身作为链接文字;在源码模式的链接地址、图片地址、代码和公式内保留粘贴原文
|
|
69
73
|
* 支持主窗口大小拖拽、字符计数
|
|
70
74
|
* 多主题支持,内置黑白绿三套主题
|
|
71
75
|
* 多语言支持,内置中、英、韩文本地化
|
|
@@ -95,6 +99,10 @@ Vditor 在这些方面做了努力,希望能为现代化的通用 Markdown 编
|
|
|
95
99
|
|
|
96
100
|

|
|
97
101
|
|
|
102
|
+
### 任务列表导航
|
|
103
|
+
|
|
104
|
+
WYSIWYG 和 IR 模式中,单独按左右方向键会跳过任务列表复选框及分隔空格,在正文之间移动。文档开头的任务会将光标留在正文开头。Shift 选择、修饰键和 Backspace 沿用现有规则,Markdown 中的空格保持不变。
|
|
105
|
+
|
|
98
106
|
## 🍱 语法支持
|
|
99
107
|
|
|
100
108
|
* 所有 CommonMark 语法:分隔线、ATX 标题、Setext 标题、缩进代码块、围栏代码块、HTML 块、链接引用定义、段落、块引用、列表、反斜杠转义、HTML 实体、行级代码、强调、加粗、链接、图片、行级 HTML、硬换行、软换行和纯文本。
|
|
@@ -142,6 +150,17 @@ import "~vditor/src/assets/less/index"
|
|
|
142
150
|
const vditor = new Vditor(id, {options...})
|
|
143
151
|
```
|
|
144
152
|
|
|
153
|
+
### ESM
|
|
154
|
+
|
|
155
|
+
支持 `module` 字段的打包工具会使用 `dist/index.mjs`,也可以直接导入 ESM 入口;静态渲染方法位于 `dist/method.mjs`。样式仍需单独引入,UMD / CommonJS 入口保持可用。
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import Vditor from "vditor/dist/index.mjs";
|
|
159
|
+
import "vditor/dist/index.css";
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
在浏览器中使用 `<script type="module">` 时,将导入地址替换为自托管的 `.mjs` 地址,并通过 `<link>` 加载 `index.css`。
|
|
163
|
+
|
|
145
164
|
### HTML script
|
|
146
165
|
|
|
147
166
|
* 在 HTML 中插入 CSS 和 JavaScript,可参考 [demo](https://b3log.org/vditor/demo/index.html)
|
|
@@ -216,7 +235,9 @@ Markdown 输出的 HTML 所展现的外观。内置 ant-design, light,dark,w
|
|
|
216
235
|
| select(value: string) | 编辑器中选中文字后触发 | - |
|
|
217
236
|
| unSelect() | 编辑器中未选中文字后触发 | - |
|
|
218
237
|
| tab | <kbd>tab</kbd> 键操作字符串,支持 `\t` 及任意字符串 | - |
|
|
219
|
-
| typewriterMode |
|
|
238
|
+
| typewriterMode | 是否启用打字机模式;输入及方向键、Home/End、PageUp/PageDown 导航后居中光标 | false |
|
|
239
|
+
| tips: {show(text: string, time: number): void, hide(): void} | 接管消息提示;time 单位为毫秒,0 表示持续显示;到期、手动隐藏和销毁时调用 hide,替换消息会重置计时 | - |
|
|
240
|
+
| configChange(preferences: IEditorPreferences): void | 编辑模式、主题、内容主题、代码主题、大纲显隐及分屏预览设置操作后的回调;不在初始化或正文输入时调用。快照可 JSON 序列化后保存,并作为下一次初始化选项合并传入;Vditor 不自动持久化 | - |
|
|
220
241
|
| cdn | 配置自建 CDN 地址 | `https://unpkg.com/vditor@${VDITOR_VERSION}` |
|
|
221
242
|
| mode | 可选模式:sv, ir, wysiwyg | 'ir' |
|
|
222
243
|
| debugger | 是否显示日志 | false |
|
|
@@ -340,6 +361,7 @@ new Vditor('vditor', {
|
|
|
340
361
|
| mark | 启用 mark 标记 | false |
|
|
341
362
|
| sup | 上标 | false |
|
|
342
363
|
| sub | 下标 | false |
|
|
364
|
+
| imgPathAllowSpace | 允许图片和链接路径包含未转义的空格 | false |
|
|
343
365
|
|
|
344
366
|
#### options.preview.theme
|
|
345
367
|
|
|
@@ -377,6 +399,44 @@ new Vditor('vditor', {
|
|
|
377
399
|
|--------|-----------|------|
|
|
378
400
|
| enable | 是否启用多媒体渲染 | true |
|
|
379
401
|
|
|
402
|
+
#### options.plantuml
|
|
403
|
+
|
|
404
|
+
| | 说明 | 默认值 |
|
|
405
|
+
| - | - | - |
|
|
406
|
+
| server | PlantUML 服务地址,需以 `/` 结尾 | `https://www.plantuml.com/plantuml/svg/` |
|
|
407
|
+
| renderer(code: string, element: HTMLElement) | 自定义渲染。传入后不再请求 PlantUML 服务,可用于接入离线渲染引擎 | - |
|
|
408
|
+
|
|
409
|
+
不配置时使用 PlantUML 官方服务,自建服务只需替换地址:
|
|
410
|
+
|
|
411
|
+
```js
|
|
412
|
+
new Vditor('vditor', {
|
|
413
|
+
plantuml: {server: 'https://plantuml.example.com/plantuml/svg/'},
|
|
414
|
+
})
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
需要浏览器端完全离线渲染时,可在应用中安装 [@plantuml/core](https://www.npmjs.com/package/@plantuml/core) 与 [@viz-js/viz](https://www.npmjs.com/package/@viz-js/viz) 这两个 npm 包,在 `renderer` 中调用:
|
|
418
|
+
|
|
419
|
+
```js
|
|
420
|
+
import Vditor from 'vditor'
|
|
421
|
+
|
|
422
|
+
const renderPlantuml = async (code) => {
|
|
423
|
+
const viz = await import('@viz-js/viz')
|
|
424
|
+
globalThis.PLANTUML_VIZ = viz
|
|
425
|
+
const {renderToString} = await import('@plantuml/core')
|
|
426
|
+
return new Promise((resolve, reject) => {
|
|
427
|
+
renderToString(code.split(/\r\n|\r|\n/), resolve, reject)
|
|
428
|
+
})
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
new Vditor('vditor', {
|
|
432
|
+
plantuml: {
|
|
433
|
+
renderer: async (code, element) => {
|
|
434
|
+
element.innerHTML = await renderPlantuml(code)
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
})
|
|
438
|
+
```
|
|
439
|
+
|
|
380
440
|
#### options.image
|
|
381
441
|
|
|
382
442
|
| | 说明 | 默认值 |
|
|
@@ -389,6 +449,7 @@ new Vditor('vditor', {
|
|
|
389
449
|
| | 说明 | 默认值 |
|
|
390
450
|
| - | - | - |
|
|
391
451
|
| isOpen | 是否打开链接地址 | true |
|
|
452
|
+
| ctrlClick | 编辑区普通点击编辑链接,Ctrl(macOS 为 ⌘)点击才跳转;不影响预览区 | false |
|
|
392
453
|
| click(bom: Element) => void | 点击链接事件 | - |
|
|
393
454
|
|
|
394
455
|
#### options.hint
|
|
@@ -480,6 +541,7 @@ if (xhr.status === 200) {
|
|
|
480
541
|
| url | 上传 url,为空则不会触发上传相关事件 | '' |
|
|
481
542
|
| max | 上传文件最大 Byte | 10 * 1024 * 1024 |
|
|
482
543
|
| linkToImgUrl | 剪切板中包含图片地址时,使用此 url 重新上传 | '' |
|
|
544
|
+
| linkToImgHandler(url: string): string \| Promise<string> | 自定义外链图片转存,返回替换 URL;空字符串保留原图,抛出异常显示错误;优先于 linkToImgUrl,接管请求时不调用 linkToImgFormat / linkToImgCallback | - |
|
|
483
545
|
| linkToImgCallback(responseText: string) | 图片地址上传回调 | - |
|
|
484
546
|
| linkToImgFormat(responseText: string): string | 对图片地址上传的返回值进行格式化 | - |
|
|
485
547
|
| success(editor: HTMLPreElement, msg: string) | 上传成功回调 | - |
|
|
@@ -495,7 +557,7 @@ if (xhr.status === 200) {
|
|
|
495
557
|
| file(files: File[]): File[] \| Promise<File[]> | 将上传的文件处理后再返回 | - |
|
|
496
558
|
| cancel(files: File[]): void | 取消正在上传的文件 | - |
|
|
497
559
|
| setHeaders(): { [key: string]: string } | 上传前使用返回值设置头 | - |
|
|
498
|
-
| extraData: { [key: string]: string \| Blob } | 为 FormData
|
|
560
|
+
| extraData: { [key: string]: string \| Blob } | 为 FormData 添加额外的参数;linkToImgUrl 的 JSON 请求仅发送字符串值,url 始终为当前图片地址 | - |
|
|
499
561
|
| multiple | 上传文件是否为多个 | true |
|
|
500
562
|
| fieldName | 上传字段名称 | 'file[]' |
|
|
501
563
|
| renderLinkDest?(vditor: IVditor, node: ILuteNode, entering: boolean): [string, number] | 处理剪贴板中的图片地址 | '' |
|
|
@@ -526,6 +588,7 @@ if (xhr.status === 200) {
|
|
|
526
588
|
| - | - | - |
|
|
527
589
|
| enable | 初始化是否展现大纲 | false |
|
|
528
590
|
| position | 大纲位置:'left', 'right' | 'left' |
|
|
591
|
+
| width | 初始宽度(像素);未设置时使用 CSS 宽度。可拖动边界调整,或聚焦分隔条后用左右方向键(Shift 加大步长)、Home/End 调整;宽度可通过 configChange 保存 | - |
|
|
529
592
|
|
|
530
593
|
#### methods
|
|
531
594
|
|
|
@@ -533,6 +596,7 @@ if (xhr.status === 200) {
|
|
|
533
596
|
| - | - |
|
|
534
597
|
| exportJSON(markdown: string) | 根据 Markdown 获取对应 JSON |
|
|
535
598
|
| getValue() | 获取 Markdown 内容 |
|
|
599
|
+
| getOutline(): IOutlineItem[] | 获取与内置大纲范围一致的顶层标题,返回文本 text、标题级别 level 和标题 ID id;SV 模式下的 ID 对应内置预览渲染后的标题 |
|
|
536
600
|
| getHTML() | 获取 HTML 内容 |
|
|
537
601
|
| insertValue(value: string, render = true) | 在焦点处插入内容,并默认进行 Markdown 渲染 |
|
|
538
602
|
| focus() | 聚焦到编辑器 |
|
|
@@ -620,12 +684,12 @@ options?: IPreviewOptions {
|
|
|
620
684
|
| md2html(mdText: string, options?: IPreviewOptions): Promise\<string> | Markdown 文本转换为 HTML,该方法需使用[异步编程](https://ld246.com/article/1546828434083?r=Vanessa#toc_h3_1) |
|
|
621
685
|
| preview(previewElement: HTMLDivElement, markdown: string, options?: IPreviewOptions) | 页面 Markdown 文章渲染 |
|
|
622
686
|
| highlightRender(hljsOption?: IHljs, element?: HTMLElement \| Document, cdn = options.cdn) | 为 element 中的代码块进行高亮渲染 |
|
|
623
|
-
| mediaRender(element: HTMLElement) | 为[特定链接](https://ld246.com/article/1589813914768)
|
|
687
|
+
| mediaRender(element: HTMLElement) | 为[特定链接](https://ld246.com/article/1589813914768)分别渲染为视频、音频(含 AAC)、嵌入的 iframe |
|
|
624
688
|
| mathRender(element: HTMLElement, options?: {cdn?: string, math?: IMath}) | 对数学公式进行渲染 |
|
|
625
689
|
| speechRender(element: HTMLElement, lang?: (keyof II18nLang)) | 对选中的文字进行阅读 |
|
|
626
|
-
| graphvizRender(element: HTMLElement, cdn?: string) | 对 graphviz
|
|
690
|
+
| graphvizRender(element: HTMLElement, cdn?: string) | 对 graphviz 进行渲染,需要浏览器支持 WebAssembly 和 Worker |
|
|
627
691
|
| wavedromRender(element: (HTMLElement \| Document) = document, cdn = options.cdn) | 对数字波形图进行渲染 |
|
|
628
|
-
| outlineRender(contentElement: HTMLElement, targetElement: Element) |
|
|
692
|
+
| outlineRender(contentElement: HTMLElement, targetElement: Element, click?: (heading: HTMLElement, event: Event) => void) | 对大纲进行渲染;配置 click 后由调用方处理标题点击及滚动,折叠按钮保持原有行为;第三参数仍兼容原有 IVditor |
|
|
629
693
|
| lazyLoadImageRender(element: (HTMLElement \| Document) = document) | 对启用懒加载的图片进行渲染 |
|
|
630
694
|
| setCodeTheme(codeTheme: string, cdn = options.cdn) | 设置代码主题,codeTheme 参见 options.preview.hljs.style |
|
|
631
695
|
| setContentTheme(contentTheme: string, path: string) | 设置内容主题,contentTheme 参见 options.preview.theme.list |
|
package/dist/index.css
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v4.0.2-alpha.
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2018-present B3log 开源, b3log.org
|
|
7
|
-
*
|
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
* in the Software without restriction, including without limitation the rights
|
|
11
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
* furnished to do so, subject to the following conditions:
|
|
14
|
-
*
|
|
15
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
* copies or substantial portions of the Software.
|
|
17
|
-
*
|
|
18
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
* SOFTWARE.
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
/*!
|
|
28
|
-
* Vditor v4.0.2-alpha.6 - A markdown editor written in TypeScript.
|
|
2
|
+
* Vditor v4.0.2-alpha.8 - A markdown editor written in TypeScript.
|
|
29
3
|
*
|
|
30
4
|
* MIT License
|
|
31
5
|
*
|
|
@@ -173,8 +147,8 @@
|
|
|
173
147
|
.vditor-tooltipped:hover::after,
|
|
174
148
|
.vditor-tooltipped:active::before,
|
|
175
149
|
.vditor-tooltipped:active::after,
|
|
176
|
-
.vditor-tooltipped:focus::before,
|
|
177
|
-
.vditor-tooltipped:focus::after {
|
|
150
|
+
.vditor-tooltipped:focus:not(.vditor-menu--disabled)::before,
|
|
151
|
+
.vditor-tooltipped:focus:not(.vditor-menu--disabled)::after {
|
|
178
152
|
display: inline-block;
|
|
179
153
|
text-decoration: none;
|
|
180
154
|
animation-name: tooltip-appear;
|
|
@@ -822,6 +796,11 @@
|
|
|
822
796
|
float: left;
|
|
823
797
|
margin-right: 3px;
|
|
824
798
|
}
|
|
799
|
+
@media (hover: none) and (pointer: coarse) {
|
|
800
|
+
.vditor-hint__hotkey {
|
|
801
|
+
display: none;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
825
804
|
.vditor-reset {
|
|
826
805
|
color: #24292e;
|
|
827
806
|
font-variant-ligatures: no-common-ligatures;
|
|
@@ -1098,6 +1077,12 @@
|
|
|
1098
1077
|
.vditor-reset .language-graphviz parsererror {
|
|
1099
1078
|
overflow: auto;
|
|
1100
1079
|
}
|
|
1080
|
+
.vditor-reset p.indent--2 {
|
|
1081
|
+
text-indent: 2em;
|
|
1082
|
+
}
|
|
1083
|
+
.vditor-reset--indent p[data-block="0"] {
|
|
1084
|
+
text-indent: 2em;
|
|
1085
|
+
}
|
|
1101
1086
|
.vditor-reset kbd {
|
|
1102
1087
|
display: inline-block;
|
|
1103
1088
|
padding: 3px 5px;
|
|
@@ -1339,11 +1324,24 @@
|
|
|
1339
1324
|
}
|
|
1340
1325
|
.vditor-outline {
|
|
1341
1326
|
width: 250px;
|
|
1327
|
+
max-width: calc(100% - 140px);
|
|
1328
|
+
flex-shrink: 0;
|
|
1342
1329
|
border-right: 1px solid var(--border-color);
|
|
1343
1330
|
background-color: var(--panel-background-color);
|
|
1344
1331
|
display: none;
|
|
1345
1332
|
overflow: auto;
|
|
1346
1333
|
}
|
|
1334
|
+
.vditor-outline__resize {
|
|
1335
|
+
display: none;
|
|
1336
|
+
width: 5px;
|
|
1337
|
+
flex-shrink: 0;
|
|
1338
|
+
cursor: col-resize;
|
|
1339
|
+
touch-action: none;
|
|
1340
|
+
}
|
|
1341
|
+
.vditor-outline__resize:hover,
|
|
1342
|
+
.vditor-outline__resize:focus-visible {
|
|
1343
|
+
background-color: var(--border-color);
|
|
1344
|
+
}
|
|
1347
1345
|
.vditor-outline--right {
|
|
1348
1346
|
border-right: 0;
|
|
1349
1347
|
border-left: 1px solid var(--border-color);
|
|
@@ -1394,6 +1392,11 @@
|
|
|
1394
1392
|
.vditor-outline__action--close {
|
|
1395
1393
|
transform: rotate(-90deg);
|
|
1396
1394
|
}
|
|
1395
|
+
@media (pointer: coarse) {
|
|
1396
|
+
.vditor-outline__resize {
|
|
1397
|
+
width: 16px;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1397
1400
|
.vditor-reset .callout,
|
|
1398
1401
|
.vditor-wysiwyg blockquote.callout,
|
|
1399
1402
|
.vditor-ir blockquote.callout {
|
|
@@ -1552,6 +1555,9 @@
|
|
|
1552
1555
|
padding-left: 0 !important;
|
|
1553
1556
|
padding-right: 0 !important;
|
|
1554
1557
|
}
|
|
1558
|
+
.vditor-wysiwyg__kbd-marker:not(.vditor-wysiwyg__kbd-marker--expand) {
|
|
1559
|
+
display: none;
|
|
1560
|
+
}
|
|
1555
1561
|
.vditor-wysiwyg__block[data-type="code-block"] > pre:not([style*="display:none"]):not([style*="display: none"]) + .vditor-code__preview {
|
|
1556
1562
|
height: 0;
|
|
1557
1563
|
min-height: 0;
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare class Vditor extends VditorMethod {
|
|
|
16
16
|
setTheme(theme: "dark" | "classic", contentTheme?: string, codeTheme?: string, contentThemePath?: string): void;
|
|
17
17
|
/** 获取 Markdown 内容 */
|
|
18
18
|
getValue(): string;
|
|
19
|
+
getOutline(): IOutlineItem[];
|
|
19
20
|
/** 获取编辑器当前编辑模式 */
|
|
20
21
|
getCurrentMode(): "sv" | "wysiwyg" | "ir";
|
|
21
22
|
/** 聚焦到编辑器 */
|