diff --git a/README.md b/README.md index 8ccc54c67..49fde20c6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@
-English | Demo +English | Demo
## 💡 简介 @@ -192,7 +192,6 @@ Markdown 输出的 HTML 所展现的外观。内置 light,dark,wechat 3 套 #### options - | | 说明 | 默认值 | | - | - | - | | undoDelay | 历史记录间隔 | - | @@ -202,7 +201,7 @@ Markdown 输出的 HTML 所展现的外观。内置 light,dark,wechat 3 套 | width | 编辑器总宽度,支持 % | 'auto' | | placeholder | 输入区域为空时的提示 | '' | | lang | 多语言:en_US, ja_JP, ko_KR, zh_CN | 'zh_CN' | -| input(value: string, previewElement?: HTMLElement) | 输入后触发 | - | +| input(value: string, previewElement?: HTMLElement) | 输入后触发 | - | | focus(value: string) | 聚焦后触发 | - | | blur(value: string) | 失焦后触发 | - | | esc(value: string) | esc 按下后触发 | - | @@ -238,7 +237,6 @@ new Vditor('vditor', { }) ``` - | | 说明 | 默认值 | | - | - | - | | name | 唯一标示 | - | @@ -254,7 +252,6 @@ new Vditor('vditor', { #### options.toolbarConfig - | | 说明 | 默认值 | | - | - | - | | hide | 是否隐藏工具栏 | false | @@ -262,7 +259,6 @@ new Vditor('vditor', { #### options.counter - | | 说明 | 默认值 | | - | - | - | | enable | 是否启用计数器 | false | @@ -272,7 +268,6 @@ new Vditor('vditor', { #### options.cache - | | 说明 | 默认值 | | - | - | - | | enable | 是否使用 localStorage 进行缓存 | true | @@ -283,7 +278,6 @@ new Vditor('vditor', { ⚠️:仅支持 wysiwyg 模式 - | | 说明 | 默认值 | | - | - | - | | enable | 是否启用评论模式 | false | @@ -294,7 +288,6 @@ new Vditor('vditor', { #### options.preview - | | 说明 | 默认值 | | - | - | - | | delay | 预览 debounce 毫秒间隔 | 1000 | @@ -306,7 +299,6 @@ new Vditor('vditor', { #### options.preview.hljs - | | 说明 | 默认值 | | - | - | - | | enable | 是否启用代码高亮 | true | @@ -315,7 +307,6 @@ new Vditor('vditor', { #### options.preview.markdown - | | 说明 | 默认值 | | - | - | - | | autoSpace | 自动空格 | false | @@ -333,7 +324,6 @@ new Vditor('vditor', { #### options.preview.theme - | | 说明 | 默认值 | | - | - | - | | current | 当前主题 | "light" | @@ -342,7 +332,6 @@ new Vditor('vditor', { #### options.preview.math - | | 说明 | 默认值 | | - | - | - | | inlineDigit | 内联数学公式起始 $ 后是否允许数字 | false | @@ -354,7 +343,6 @@ new Vditor('vditor', { 默认值为 ["desktop", "tablet", "mobile", "mp-wechat", "zhihu"]。 可从默认值中挑选进行配置,也可使用以下字段进行自定制开发。 - | | 说明 | 默认值 | | - | - | - | | key | 按钮唯一标识,不能为空 | - | @@ -365,7 +353,6 @@ new Vditor('vditor', { #### options.hint - | | 说明 | 默认值 | | - | - | - | | delay | 提示 debounce 毫秒间隔 | 200 | @@ -444,7 +431,6 @@ if (xhr.status === 200) { } ``` - | | 说明 | 默认值 | | - | - | - | | url | 上传 url | '' | @@ -459,18 +445,17 @@ if (xhr.status === 200) { | headers | 请求头设置 | - | | filename(name: string): string | 文件名安全处理 | name => name.replace(/\W/g, '') | | accept | 文件上传类型,同[input accept](https://www.w3schools.com/tags/att_input_accept.asp) | - | -| validate(files: File[]) => string\| boolean | 校验,成功时返回 true 否则返回错误信息 | - | -| handler(files: File[]) => string\| null | 自定义上传,当发生错误时返回错误信息 | - | +| validate(files: File[]) => string \| boolean | 校验,成功时返回 true 否则返回错误信息 | - | +| handler(files: File[]) => string \| null | 自定义上传,当发生错误时返回错误信息 | - | | format(files: File[], responseText: string): string | 对服务端返回的数据进行转换,以满足内置的数据结构 | - | | file(files: File[]): File[] | 将上传的文件处理后再返回 | - | | setHeaders(): { [key: string]: string } | 上传前使用返回值设置头 | - | -| extraData: { [key: string]: string\| Blob } | 为 FormData 添加额外的参数 | - | +| extraData: { [key: string]: string \| Blob } | 为 FormData 添加额外的参数 | - | | multiple | 上传文件是否为多个 | true | | fieldName | 上传字段名称 | 'file[]' | #### options.resize - | | 说明 | 默认值 | | - | - | - | | enable | 是否支持大小拖拽 | false | @@ -479,7 +464,6 @@ if (xhr.status === 200) { #### options.classes - | | 说明 | 默认值 | | - | - | - | | preview | 预览元素上的 className | '' | @@ -499,7 +483,6 @@ if (xhr.status === 200) { #### methods - | | 说明 | | - | - | | getValue() | 获取 Markdown 内容 | @@ -511,7 +494,7 @@ if (xhr.status === 200) { | enable() | 解除编辑器禁用 | | getSelection(): string | 返回选中的字符串 | | setValue(markdown: string, clearStack = false) | 设置编辑器内容且选中清空历史栈 | -| clearStack() | 清空撤销和重做记录栈 | +| clearStack() | 清空撤销和重做记录栈| | renderPreview(value?: string) | 设置预览区域内容 | | getCursorPosition():{top: number, left: number} | 获取焦点位置 | | deleteValue() | 删除选中内容 | @@ -522,8 +505,8 @@ if (xhr.status === 200) { | enableCache() | 启用缓存 | | html2md(value: string) | HTML 转 md | | tip(text: string, time: number) | 消息提示。time 为 0 将一直显示 | -| setPreviewMode(mode: "both"\| "editor") | 设置预览模式 | -| setTheme(theme: "dark"\| "classic", contentTheme?: string, codeTheme?: string, contentThemePath?: string) | 设置主题、内容主题及代码块风格 | +| setPreviewMode(mode: "both" \| "editor") | 设置预览模式 | +| setTheme(theme: "dark" \| "classic", contentTheme?: string, codeTheme?: string, contentThemePath?: string) | 设置主题、内容主题及代码块风格 | | getCurrentMode(): string | 获取编辑器当前编辑模式 | | destroy() | 销毁编辑器 | | getCommentIds(): {id: string, top: number}[] | 获取所有评论 | @@ -572,25 +555,24 @@ options?: IPreviewOptions { * ⚠️ `method.min.js` 和 `index.min.js` 不可同时引入 - | | 说明 | | - | - | | previewImage(oldImgElement: HTMLImageElement, lang: keyof II18n = "zh_CN", theme = "classic") | 点击图片预览 | | mermaidRender(element: HTMLElement, cdn = options.cdn, theme = options.theme) | 流程图/时序图/甘特图 | | flowchartRender(element: HTMLElement, cdn = options.cdn) | flowchart 渲染 | | codeRender(element: HTMLElement, lang: (keyof II18nLang) = "zh_CN") | 为 element 中的代码块添加复制按钮 | -| chartRender(element: (HTMLElement\| Document) = document, cdn = options.cdn, theme = options.theme) | 图表渲染 | -| mindmapRender(element: (HTMLElement\| Document) = document, cdn = options.cdn, theme = options.theme) | 脑图渲染 | -| abcRender(element: (HTMLElement\| Document) = document, cdn = options.cdn) | 五线谱渲染 | +| chartRender(element: (HTMLElement \| Document) = document, cdn = options.cdn, theme = options.theme) | 图表渲染 | +| mindmapRender(element: (HTMLElement \| Document) = document, cdn = options.cdn, theme = options.theme) | 脑图渲染 | +| abcRender(element: (HTMLElement \| Document) = document, cdn = options.cdn) | 五线谱渲染 | | md2html(mdText: string, options?: IPreviewOptions): Promise\