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.
Files changed (45) hide show
  1. package/README.md +2 -2
  2. package/dist/index.css +2 -2
  3. package/dist/index.min.js +1 -15469
  4. package/dist/js/highlight.js/styles/abap.css +7 -96
  5. package/dist/js/highlight.js/styles/algol.css +7 -104
  6. package/dist/js/highlight.js/styles/algol_nu.css +7 -52
  7. package/dist/js/highlight.js/styles/arduino.css +7 -95
  8. package/dist/js/highlight.js/styles/autumn.css +7 -76
  9. package/dist/js/highlight.js/styles/borland.css +7 -94
  10. package/dist/js/highlight.js/styles/bw.css +7 -108
  11. package/dist/js/highlight.js/styles/colorful.css +7 -90
  12. package/dist/js/highlight.js/styles/dracula.css +9 -86
  13. package/dist/js/highlight.js/styles/emacs.css +7 -103
  14. package/dist/js/highlight.js/styles/friendly.css +7 -119
  15. package/dist/js/highlight.js/styles/fruity.css +7 -76
  16. package/dist/js/highlight.js/styles/github.css +7 -106
  17. package/dist/js/highlight.js/styles/igor.css +7 -90
  18. package/dist/js/highlight.js/styles/lovelace.css +7 -77
  19. package/dist/js/highlight.js/styles/manni.css +7 -75
  20. package/dist/js/highlight.js/styles/monokai.css +7 -77
  21. package/dist/js/highlight.js/styles/monokailight.css +7 -114
  22. package/dist/js/highlight.js/styles/murphy.css +7 -78
  23. package/dist/js/highlight.js/styles/native.css +7 -103
  24. package/dist/js/highlight.js/styles/paraiso-dark.css +7 -79
  25. package/dist/js/highlight.js/styles/paraiso-light.css +7 -78
  26. package/dist/js/highlight.js/styles/pastie.css +7 -115
  27. package/dist/js/highlight.js/styles/perldoc.css +7 -80
  28. package/dist/js/highlight.js/styles/pygments.css +7 -95
  29. package/dist/js/highlight.js/styles/rainbow_dash.css +7 -103
  30. package/dist/js/highlight.js/styles/rrt.css +7 -119
  31. package/dist/js/highlight.js/styles/solarized-dark.css +7 -91
  32. package/dist/js/highlight.js/styles/solarized-dark256.css +7 -90
  33. package/dist/js/highlight.js/styles/solarized-light.css +7 -90
  34. package/dist/js/highlight.js/styles/swapoff.css +7 -99
  35. package/dist/js/highlight.js/styles/tango.css +7 -106
  36. package/dist/js/highlight.js/styles/trac.css +7 -105
  37. package/dist/js/highlight.js/styles/vim.css +7 -89
  38. package/dist/js/highlight.js/styles/vs.css +7 -75
  39. package/dist/js/highlight.js/styles/xcode.css +7 -111
  40. package/dist/js/katex/mhchem.min.js +1 -0
  41. package/dist/js/lute/lute.min.js +10 -9
  42. package/dist/method.min.js +1 -2370
  43. package/package.json +5 -5
  44. package/src/ts/markdown/mathRender.ts +29 -27
  45. 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.10",
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": "^9.8.6",
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.1.2",
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.37.0",
47
+ "webpack": "^5.66.0",
48
48
  "webpack-bundle-analyzer": "^3.9.0",
49
- "webpack-cli": "^4.7.0",
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
- mathElements.forEach((mathElement) => {
46
- if (mathElement.parentElement.classList.contains("vditor-wysiwyg__pre") ||
47
- mathElement.parentElement.classList.contains("vditor-ir__marker--pre")) {
48
- return;
49
- }
50
- if (mathElement.getAttribute("data-math")) {
51
- return;
52
- }
53
- const math = code160to32(mathRenderAdapter.getCode(mathElement));
54
- mathElement.setAttribute("data-math", math);
55
- try {
56
- mathElement.innerHTML = katex.renderToString(math, {
57
- displayMode: mathElement.tagName === "DIV",
58
- output: "html",
59
- });
60
- } catch (e) {
61
- mathElement.innerHTML = e.message;
62
- mathElement.className = "language-math vditor-reset--error";
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
- mathElement.addEventListener("copy", (event: ClipboardEvent) => {
66
- event.stopPropagation();
67
- event.preventDefault();
68
- const vditorMathElement = (event.currentTarget as HTMLElement).closest(".language-math");
69
- event.clipboardData.setData("text/html", vditorMathElement.innerHTML);
70
- event.clipboardData.setData("text/plain",
71
- vditorMathElement.getAttribute("data-math"));
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: { mathjax: `${options.cdn}/dist/js/mathjax` },
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) => {