vditor 3.8.10 → 3.8.11
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 +2 -2
- package/dist/index.css +2 -2
- package/dist/index.min.js +1 -15469
- package/dist/js/highlight.js/styles/abap.css +7 -96
- package/dist/js/highlight.js/styles/algol.css +7 -104
- package/dist/js/highlight.js/styles/algol_nu.css +7 -52
- package/dist/js/highlight.js/styles/arduino.css +7 -95
- package/dist/js/highlight.js/styles/autumn.css +7 -76
- package/dist/js/highlight.js/styles/borland.css +7 -94
- package/dist/js/highlight.js/styles/bw.css +7 -108
- package/dist/js/highlight.js/styles/colorful.css +7 -90
- package/dist/js/highlight.js/styles/dracula.css +9 -86
- package/dist/js/highlight.js/styles/emacs.css +7 -103
- package/dist/js/highlight.js/styles/friendly.css +7 -119
- package/dist/js/highlight.js/styles/fruity.css +7 -76
- package/dist/js/highlight.js/styles/github.css +7 -106
- package/dist/js/highlight.js/styles/igor.css +7 -90
- package/dist/js/highlight.js/styles/lovelace.css +7 -77
- package/dist/js/highlight.js/styles/manni.css +7 -75
- package/dist/js/highlight.js/styles/monokai.css +7 -77
- package/dist/js/highlight.js/styles/monokailight.css +7 -114
- package/dist/js/highlight.js/styles/murphy.css +7 -78
- package/dist/js/highlight.js/styles/native.css +7 -103
- package/dist/js/highlight.js/styles/paraiso-dark.css +7 -79
- package/dist/js/highlight.js/styles/paraiso-light.css +7 -78
- package/dist/js/highlight.js/styles/pastie.css +7 -115
- package/dist/js/highlight.js/styles/perldoc.css +7 -80
- package/dist/js/highlight.js/styles/pygments.css +7 -95
- package/dist/js/highlight.js/styles/rainbow_dash.css +7 -103
- package/dist/js/highlight.js/styles/rrt.css +7 -119
- package/dist/js/highlight.js/styles/solarized-dark.css +7 -91
- package/dist/js/highlight.js/styles/solarized-dark256.css +7 -90
- package/dist/js/highlight.js/styles/solarized-light.css +7 -90
- package/dist/js/highlight.js/styles/swapoff.css +7 -99
- package/dist/js/highlight.js/styles/tango.css +7 -106
- package/dist/js/highlight.js/styles/trac.css +7 -105
- package/dist/js/highlight.js/styles/vim.css +7 -89
- package/dist/js/highlight.js/styles/vs.css +7 -75
- package/dist/js/highlight.js/styles/xcode.css +7 -111
- package/dist/js/katex/mhchem.min.js +1 -0
- package/dist/js/lute/lute.min.js +10 -9
- package/dist/method.min.js +1 -2370
- package/package.json +5 -5
- package/src/ts/markdown/mathRender.ts +29 -27
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vditor",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.11",
|
|
4
4
|
"description": "♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生",
|
|
5
5
|
"author": "Vanessa <v@b3log.org> (http://vanessa.b3log.org)",
|
|
6
6
|
"homepage": "https://b3log.org/vditor",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/diff-match-patch": "^1.0.32",
|
|
25
25
|
"@types/jest": "^26.0.23",
|
|
26
26
|
"@types/puppeteer": "^2.1.5",
|
|
27
|
-
"autoprefixer": "^
|
|
27
|
+
"autoprefixer": "^10.4.2",
|
|
28
28
|
"babel-loader": "^8.2.2",
|
|
29
29
|
"clean-webpack-plugin": "^4.0.0-alpha.0",
|
|
30
30
|
"copy-webpack-plugin": "^6.4.1",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"puppeteer": "^1.20.0",
|
|
40
40
|
"sass-loader": "^12.4.0",
|
|
41
41
|
"style-loader": "^1.3.0",
|
|
42
|
-
"terser-webpack-plugin": "^5.
|
|
42
|
+
"terser-webpack-plugin": "^5.3.0",
|
|
43
43
|
"ts-jest": "^26.5.6",
|
|
44
44
|
"ts-loader": "^6.2.2",
|
|
45
45
|
"tslint": "^5.20.1",
|
|
46
46
|
"typescript": "^3.9.9",
|
|
47
|
-
"webpack": "^5.
|
|
47
|
+
"webpack": "^5.66.0",
|
|
48
48
|
"webpack-bundle-analyzer": "^3.9.0",
|
|
49
|
-
"webpack-cli": "^4.
|
|
49
|
+
"webpack-cli": "^4.9.1",
|
|
50
50
|
"webpack-dev-server": "^4.1.0"
|
|
51
51
|
},
|
|
52
52
|
"license": "MIT",
|
|
@@ -42,33 +42,35 @@ export const mathRender = (element: HTMLElement, options?: { cdn?: string, math?
|
|
|
42
42
|
if (options.math.engine === "KaTeX") {
|
|
43
43
|
addStyle(`${options.cdn}/dist/js/katex/katex.min.css`, "vditorKatexStyle");
|
|
44
44
|
addScript(`${options.cdn}/dist/js/katex/katex.min.js`, "vditorKatexScript").then(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
mathElement.parentElement.classList.contains("vditor-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
45
|
+
addScript(`${options.cdn}/dist/js/katex/mhchem.min.js`, "vditorKatexChemScript").then(() => {
|
|
46
|
+
mathElements.forEach((mathElement) => {
|
|
47
|
+
if (mathElement.parentElement.classList.contains("vditor-wysiwyg__pre") ||
|
|
48
|
+
mathElement.parentElement.classList.contains("vditor-ir__marker--pre")) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (mathElement.getAttribute("data-math")) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const math = code160to32(mathRenderAdapter.getCode(mathElement));
|
|
55
|
+
mathElement.setAttribute("data-math", math);
|
|
56
|
+
try {
|
|
57
|
+
mathElement.innerHTML = katex.renderToString(math, {
|
|
58
|
+
displayMode: mathElement.tagName === "DIV",
|
|
59
|
+
output: "html",
|
|
60
|
+
});
|
|
61
|
+
} catch (e) {
|
|
62
|
+
mathElement.innerHTML = e.message;
|
|
63
|
+
mathElement.className = "language-math vditor-reset--error";
|
|
64
|
+
}
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
mathElement.addEventListener("copy", (event: ClipboardEvent) => {
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
const vditorMathElement = (event.currentTarget as HTMLElement).closest(".language-math");
|
|
70
|
+
event.clipboardData.setData("text/html", vditorMathElement.innerHTML);
|
|
71
|
+
event.clipboardData.setData("text/plain",
|
|
72
|
+
vditorMathElement.getAttribute("data-math"));
|
|
73
|
+
});
|
|
72
74
|
});
|
|
73
75
|
});
|
|
74
76
|
});
|
|
@@ -88,7 +90,7 @@ export const mathRender = (element: HTMLElement, options?: { cdn?: string, math?
|
|
|
88
90
|
if (!window.MathJax) {
|
|
89
91
|
window.MathJax = {
|
|
90
92
|
loader: {
|
|
91
|
-
paths: {
|
|
93
|
+
paths: {mathjax: `${options.cdn}/dist/js/mathjax`},
|
|
92
94
|
},
|
|
93
95
|
startup: {
|
|
94
96
|
typeset: false,
|
|
@@ -972,8 +972,6 @@ const linkHotkey = (
|
|
|
972
972
|
};
|
|
973
973
|
|
|
974
974
|
export const genAPopover = (vditor: IVditor, aElement: HTMLElement) => {
|
|
975
|
-
const lang: keyof II18n | "" = vditor.options.lang;
|
|
976
|
-
const options: IOptions = vditor.options;
|
|
977
975
|
vditor.wysiwyg.popover.innerHTML = "";
|
|
978
976
|
|
|
979
977
|
const updateA = () => {
|
|
@@ -982,6 +980,7 @@ export const genAPopover = (vditor: IVditor, aElement: HTMLElement) => {
|
|
|
982
980
|
}
|
|
983
981
|
aElement.setAttribute("href", input1.value);
|
|
984
982
|
aElement.setAttribute("title", input2.value);
|
|
983
|
+
afterRenderEvent(vditor);
|
|
985
984
|
};
|
|
986
985
|
|
|
987
986
|
aElement.querySelectorAll("[data-marker]").forEach((item: HTMLElement) => {
|