Comparing version 3.8.4 to 3.8.5
/// <reference types="./types" /> | ||
import "./assets/scss/index.scss"; | ||
import VditorMethod from "./method"; | ||
@@ -3,0 +4,0 @@ declare class Vditor extends VditorMethod { |
/// <reference types="./types" /> | ||
declare class Vditor { | ||
/** 点击图片放大 */ | ||
static previewImage: (oldImgElement: HTMLImageElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "zh_CN", theme?: string) => void; | ||
static previewImage: (oldImgElement: HTMLImageElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "ru_RU" | "zh_CN" | "zh_TW", theme?: string) => void; | ||
/** 为 element 中的代码块添加复制按钮 */ | ||
static codeRender: (element: HTMLElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "zh_CN") => void; | ||
static codeRender: (element: HTMLElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "ru_RU" | "zh_CN" | "zh_TW") => void; | ||
/** 对 graphviz 进行渲染 */ | ||
@@ -33,3 +33,3 @@ static graphvizRender: (element: HTMLElement, cdn?: string) => void; | ||
/** 对选中的文字进行阅读 */ | ||
static speechRender: (element: HTMLElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "zh_CN") => void; | ||
static speechRender: (element: HTMLElement, lang?: "en_US" | "ja_JP" | "ko_KR" | "ru_RU" | "zh_CN" | "zh_TW") => void; | ||
/** 对图片进行懒加载 */ | ||
@@ -36,0 +36,0 @@ static lazyLoadImageRender: (element?: HTMLElement | Document) => boolean; |
{ | ||
"name": "vditor", | ||
"version": "3.8.4", | ||
"version": "3.8.5", | ||
"description": "♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生", | ||
@@ -22,13 +22,14 @@ "author": "Vanessa <v@b3log.org> (http://vanessa.b3log.org)", | ||
"devDependencies": { | ||
"@babel/core": "^7.10.4", | ||
"@babel/preset-env": "^7.10.4", | ||
"@babel/core": "^7.14.2", | ||
"@babel/preset-env": "^7.14.2", | ||
"@types/diff-match-patch": "^1.0.32", | ||
"@types/jest": "^26.0.19", | ||
"@types/puppeteer": "^2.1.1", | ||
"autoprefixer": "^9.8.4", | ||
"babel-loader": "^8.1.0", | ||
"copy-webpack-plugin": "^6.0.3", | ||
"css-loader": "^3.6.0", | ||
"@types/jest": "^26.0.23", | ||
"@types/puppeteer": "^2.1.5", | ||
"autoprefixer": "^9.8.6", | ||
"babel-loader": "^8.2.2", | ||
"clean-webpack-plugin": "^4.0.0-alpha.0", | ||
"copy-webpack-plugin": "^6.4.1", | ||
"css-loader": "^5.2.4", | ||
"file-loader": "^4.3.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"html-webpack-plugin": "^5.3.1", | ||
"identity-obj-proxy": "^3.0.0", | ||
@@ -38,17 +39,15 @@ "jest": "^26.6.3", | ||
"node-sass": "^4.14.1", | ||
"on-build-webpack": "^0.1.0", | ||
"optimize-css-assets-webpack-plugin": "^5.0.3", | ||
"postcss-loader": "^3.0.0", | ||
"postcss-loader": "^5.2.0", | ||
"puppeteer": "^1.20.0", | ||
"rimraf": "^3.0.2", | ||
"sass-loader": "^7.3.1", | ||
"style-loader": "^1.2.1", | ||
"ts-jest": "^26.4.4", | ||
"sass-loader": "^10.2.0", | ||
"style-loader": "^1.3.0", | ||
"terser-webpack-plugin": "^5.1.2", | ||
"ts-jest": "^26.5.6", | ||
"ts-loader": "^6.2.2", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.9.6", | ||
"webpack": "^4.43.0", | ||
"webpack-bundle-analyzer": "^3.8.0", | ||
"webpack-cli": "^3.3.12", | ||
"webpack-dev-server": "^3.11.0" | ||
"typescript": "^3.9.9", | ||
"webpack": "^5.37.0", | ||
"webpack-bundle-analyzer": "^3.9.0", | ||
"webpack-cli": "^4.7.0", | ||
"webpack-dev-server": "^3.11.2" | ||
}, | ||
@@ -64,3 +63,3 @@ "license": "MIT", | ||
"test": "jest --coverage", | ||
"start": "webpack-dev-server --config webpack.start.js", | ||
"start": "webpack serve --config webpack.start.js", | ||
"build": "webpack" | ||
@@ -67,0 +66,0 @@ }, |
@@ -203,3 +203,3 @@ <p align="center"> | ||
| placeholder | 输入区域为空时的提示 | '' | | ||
| lang | 多语言:en_US, ja_JP, ko_KR, zh_CN | 'zh_CN' | | ||
| lang | 多语言:en_US, ja_JP, ko_KR, ru_RU, zh_CN, zh_TW | 'zh_CN' | | ||
| input(value: string) | 输入后触发 | - | | ||
@@ -438,3 +438,3 @@ | focus(value: string) | 聚焦后触发 | - | | ||
| - | - | - | | ||
| url | 上传 url | '' | | ||
| url | 上传 url,为空则不会触发上传相关事件 | '' | | ||
| max | 上传文件最大 Byte | 10 * 1024 * 1024 | | ||
@@ -441,0 +441,0 @@ | linkToImgUrl | 剪切板中包含图片地址时,使用此 url 重新上传 | '' | |
@@ -0,7 +1,8 @@ | ||
import "./assets/scss/index.scss"; | ||
import VditorMethod from "./method"; | ||
import {Constants, VDITOR_VERSION} from "./ts/constants"; | ||
import {DevTools} from "./ts/devtools"; | ||
import {DevTools} from "./ts/devtools/index"; | ||
import {Hint} from "./ts/hint/index"; | ||
import {i18n} from "./ts/i18n"; | ||
import {IR} from "./ts/ir"; | ||
import {i18n} from "./ts/i18n/index"; | ||
import {IR} from "./ts/ir/index"; | ||
import {input as irInput} from "./ts/ir/input"; | ||
@@ -70,3 +71,3 @@ import {processAfterRender} from "./ts/ir/process"; | ||
if (!["en_US", "ja_JP", "ko_KR", "zh_CN"].includes(mergedOptions.lang)) { | ||
if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) { | ||
throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options"); | ||
@@ -73,0 +74,0 @@ } |
@@ -21,6 +21,10 @@ declare const VDITOR_VERSION: string; | ||
public static readonly CODE_LANGUAGES: string[] = ["mermaid", "echarts", "mindmap", "plantuml", "abc", "graphviz", "flowchart", "apache", | ||
"bash", "cs", "cpp", "css", "coffeescript", "diff", "xml", "http", "ini", "json", "java", "javascript", "js", | ||
"makefile", "markdown", "nginx", "objectivec", "php", "perl", "properties", "python", "ruby", "sql", "shell", | ||
"dart", "erb", "go", "gradle", "julia", "kotlin", "less", "lua", "matlab", "rust", "scss", "typescript", "ts", | ||
"yaml"]; | ||
"js", "ts", "html", | ||
// common | ||
"properties", "apache", "bash", "c", "csharp", "cpp", "css", "coffeescript", "diff", "go", "xml", "http", | ||
"json", "java", "javascript", "kotlin", "less", "lua", "makefile", "markdown", "nginx", "objectivec", "php", | ||
"php-template", "perl", "plaintext", "python", "python-repl", "r", "ruby", "rust", "scss", "sql", "shell", | ||
"swift", "ini", "typescript", "vbnet", "yaml", | ||
"ada", "clojure", "dart", "erb", "fortran", "gradle", "haskell", "julia", "julia-repl", "lisp", "matlab", | ||
"pgsql", "powershell", "sql_more", "stata", "cmake", "mathematica"]; | ||
public static readonly CDN = `https://cdn.jsdelivr.net/npm/vditor@${VDITOR_VERSION}`; | ||
@@ -27,0 +31,0 @@ public static readonly MARKDOWN_OPTIONS = { |
@@ -239,2 +239,81 @@ export const i18n: II18n = { | ||
}, | ||
ru_RU: { | ||
"alignCenter": "Выровнять по центру", | ||
"alignLeft": "Выровнять по левому краю", | ||
"alignRight": "Выровнять по правому краю", | ||
"alternateText": "Альтернативный текст", | ||
"bold": "Полужирный текст", | ||
"both": "Редактор с предпросмотром", | ||
"check": "Список задач", | ||
"close": "Закрыть", | ||
"code": "Блок кода", | ||
"code-theme": "Тема отображения блока кода", | ||
"column": "Количество столбцов", | ||
"comment": "Комментарий", | ||
"confirm": "Подтвердить", | ||
"content-theme": "Тема отображения контента", | ||
"copied": "Скопировано", | ||
"copy": "Копировать", | ||
"delete-column": "Удалить столбец", | ||
"delete-row": "Удалить строку", | ||
"devtools": "Граф документа", | ||
"down": "Переместить вниз", | ||
"downloadTip": "Браузер не поддерживает функции загрузки", | ||
"edit": "Редактирование", | ||
"edit-mode": "Переключить режим редактирования", | ||
"emoji": "Смайлы", | ||
"export": "Экспорт", | ||
"fileTypeError": "Ошибка типа файла", | ||
"footnoteRef": "Сноска", | ||
"fullscreen": "Переключиться на полный экран", | ||
"generate": "Генерация", | ||
"headings": "Заголовки", | ||
"help": "Помощь", | ||
"imageURL": "Ссылка на картинку", | ||
"indent": "Отступ", | ||
"info": "Информация о редакторе", | ||
"inline-code": "Встроенный код ", | ||
"insert-after": "Вставить линию после этой строки", | ||
"insert-before": "Вставить линию перед этой строкой", | ||
"insertColumnLeft": "Вставить столбец слева", | ||
"insertColumnRight": "Вставить столбец справа", | ||
"insertRowAbove": "Вставить строку сверху", | ||
"insertRowBelow": "Вставить строку снизу", | ||
"instantRendering": "Мгновенный рендеринг", | ||
"italic": "Курсив", | ||
"language": "Синтаксис", | ||
"line": "Линия", | ||
"link": "Ссылка", | ||
"linkRef": "Вставить ссылку", | ||
"list": "Список", | ||
"more": "Дополнительно", | ||
"nameEmpty": "Имя пустое", | ||
"ordered-list": "Упорядоченный список", | ||
"outdent": "Выступ", | ||
"outline": "Содержание", | ||
"over": "Над", | ||
"performanceTip": "Предварительный просмотр в реальном времени требует ${x}мс, вы можете закрыть его", | ||
"preview": "Предпросмотр", | ||
"quote": "Цитата", | ||
"record": "Начать запись/Завершить запись", | ||
"record-tip": "Устройство не поддерживает запись", | ||
"recording": "Запись...", | ||
"redo": "Вернуть", | ||
"remove": "Удалить", | ||
"row": "Количество строк", | ||
"spin": "Прокрутка", | ||
"splitView": "Разделенный просмотр", | ||
"strike": "Зачеркнутый текст", | ||
"table": "Таблица", | ||
"textIsNotEmpty": "Текст (непустой)", | ||
"title": "Заголовок", | ||
"tooltipText": "Текст всплывающей подсказки", | ||
"undo": "Отменить", | ||
"up": "Переместить вверх", | ||
"update": "Обновить", | ||
"upload": "Загрузить изображение или файл", | ||
"uploadError": "Ошибка загрузки", | ||
"uploading": "Загрузка...", | ||
"wysiwyg": "Редактор WYSIWYG", | ||
}, | ||
zh_CN: { | ||
@@ -319,2 +398,81 @@ "alignCenter": "居中", | ||
}, | ||
zh_TW: { | ||
"alignCenter": "置中", | ||
"alignLeft": "置左", | ||
"alignRight": "置右", | ||
"alternateText": "替代文字", | ||
"bold": "粗體", | ||
"both": "編輯 & 預覽", | ||
"check": "任務列表", | ||
"close": "關閉", | ||
"code": "代碼塊", | ||
"code-theme": "代碼塊主題預覽", | ||
"column": "欄", | ||
"comment": "評論", | ||
"confirm": "確定", | ||
"content-theme": "內容主題預覽", | ||
"copied": "已複製", | ||
"copy": "複製", | ||
"delete-column": "刪除欄", | ||
"delete-row": "刪除列", | ||
"devtools": "開發者工具", | ||
"down": "下", | ||
"downloadTip": "該瀏覽器不支持下載功能", | ||
"edit": "編輯", | ||
"edit-mode": "切換編輯模式", | ||
"emoji": "表情", | ||
"export": "匯出", | ||
"fileTypeError": "檔案類型不允許上傳", | ||
"footnoteRef": "腳註參考", | ||
"fullscreen": "全螢幕切換", | ||
"generate": "生成中", | ||
"headings": "標題", | ||
"help": "幫助", | ||
"imageURL": "圖片位址", | ||
"indent": "列表縮排", | ||
"info": "關於", | ||
"inline-code": "行內代碼", | ||
"insert-after": "末尾插入列", | ||
"insert-before": "起始插入列", | ||
"insertColumnLeft": "在左邊插入一欄", | ||
"insertColumnRight": "在右邊插入一欄", | ||
"insertRowAbove": "在上方插入一行", | ||
"insertRowBelow": "在下方插入一行", | ||
"instantRendering": "即時渲染", | ||
"italic": "斜體", | ||
"language": "語言", | ||
"line": "分隔線", | ||
"link": "連結", | ||
"linkRef": "連結參考", | ||
"list": "無序列表", | ||
"more": "更多", | ||
"nameEmpty": "文件名不能為空", | ||
"ordered-list": "有序列表", | ||
"outdent": "列表反向縮排", | ||
"outline": "大綱", | ||
"over": "超過", | ||
"performanceTip": "即時預覽需 ${x}ms,可點擊編輯 & 預覽按鈕進行關閉", | ||
"preview": "預覽", | ||
"quote": "引用", | ||
"record": "開始錄音/結束錄音", | ||
"record-tip": "該設備不支持錄音功能", | ||
"recording": "錄音中...", | ||
"redo": "重做", | ||
"remove": "刪除", | ||
"row": "列", | ||
"spin": "旋轉", | ||
"splitView": "分割預覽", | ||
"strike": "刪除縣", | ||
"table": "表格", | ||
"textIsNotEmpty": "文字(不能為空)", | ||
"title": "標題", | ||
"tooltipText": "提示文字", | ||
"undo": "撤銷", | ||
"up": "上", | ||
"update": "更新", | ||
"upload": "上傳圖片或文件", | ||
"uploadError": "上傳錯誤", | ||
"uploading": "上傳中...", | ||
"wysiwyg": "所見即所得", | ||
} | ||
}; |
@@ -6,3 +6,3 @@ import {Constants} from "../constants"; | ||
declare const hljs: { | ||
highlightBlock(element: Element): void; | ||
highlightElement(element: Element): void; | ||
}; | ||
@@ -40,3 +40,3 @@ | ||
if (block.classList.contains("language-mermaid") || block.classList.contains("language-flowchat") || | ||
if (block.classList.contains("language-mermaid") || block.classList.contains("language-flowchart") || | ||
block.classList.contains("language-echarts") || block.classList.contains("language-mindmap") || | ||
@@ -48,3 +48,3 @@ block.classList.contains("language-plantuml") || | ||
} | ||
hljs.highlightBlock(block); | ||
hljs.highlightElement(block); | ||
@@ -51,0 +51,0 @@ if (!hljsOption.lineNumber) { |
@@ -101,3 +101,3 @@ import {Constants} from "../constants"; | ||
// 循环加载会抛异常 | ||
addScriptSync(`${options.cdn}/dist/js/mathjax/tex-svg.js`, "vditorMathJaxScript"); | ||
addScriptSync(`${options.cdn}/dist/js/mathjax/tex-svg-full.js`, "protyleMathJaxScript"); | ||
const renderMath = (mathElement: Element, next?: () => void) => { | ||
@@ -104,0 +104,0 @@ const math = code160to32(mathElement.textContent).trim(); |
@@ -1,2 +0,2 @@ | ||
import DiffMatchPatch, {diff_match_patch, patch_obj} from "diff-match-patch"; | ||
import * as DiffMatchPatch from "diff-match-patch"; | ||
import {disableToolbar, enableToolbar, hidePanel} from "../toolbar/setToolbar"; | ||
@@ -13,4 +13,4 @@ import {isFirefox, isSafari} from "../util/compatibility"; | ||
lastText: string; | ||
redoStack: patch_obj[][]; | ||
undoStack: patch_obj[][]; | ||
redoStack: DiffMatchPatch.patch_obj[][]; | ||
undoStack: DiffMatchPatch.patch_obj[][]; | ||
} | ||
@@ -20,3 +20,3 @@ | ||
private stackSize = 50; | ||
private dmp: diff_match_patch; | ||
private dmp: DiffMatchPatch.diff_match_patch; | ||
private wysiwyg: IUndo; | ||
@@ -136,3 +136,3 @@ private ir: IUndo; | ||
private renderDiff(state: patch_obj[], vditor: IVditor, isRedo: boolean = false) { | ||
private renderDiff(state: DiffMatchPatch.patch_obj[], vditor: IVditor, isRedo: boolean = false) { | ||
let text; | ||
@@ -139,0 +139,0 @@ if (isRedo) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
16931872
29
78076
412