Skip to content

Commit

Permalink
⬆️ fix #1297
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 23, 2022
1 parent 71f8d05 commit f5ac1b6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 121 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -103,8 +103,9 @@

* [open issues](https://github.com/Vanessa219/vditor/issues)

### v3.8.18 / 2022-09
### v3.8.18 / 2022-11

* [1297](https://github.com/Vanessa219/vditor/issues/1297) mermaid 升级到 9.1.7 `改进功能`
* [1289](https://github.com/Vanessa219/vditor/issues/1289) 切换输入法后光标错位 `兼容性`
* [1278](https://github.com/Vanessa219/vditor/issues/1278) RenderJSON 导出的 JSON 不正确 `修复缺陷`
* [1275](https://github.com/Vanessa219/vditor/issues/1275) XSS 安全漏洞 `修复缺陷`
Expand Down
35 changes: 3 additions & 32 deletions src/js/mermaid/mermaid.min.js

Large diffs are not rendered by default.

98 changes: 10 additions & 88 deletions src/ts/markdown/mermaidRender.ts
Expand Up @@ -14,105 +14,27 @@ export const mermaidRender = (element: HTMLElement, cdn = Constants.CDN, theme:
}
addScript(`${cdn}/dist/js/mermaid/mermaid.min.js`, "vditorMermaidScript").then(() => {
const config: any = {
securityLevel: "loose", // 升级后无 https://github.com/siyuan-note/siyuan/issues/3587,可使用该选项
altFontFamily: "sans-serif",
fontFamily: "sans-serif",
startOnLoad: false,
flowchart: {
htmlLabels: true,
useMaxWidth: true,
},
fontFamily: "sans-serif",
gantt: {
leftPadding: 75,
rightPadding: 20,
useMaxWidth: !0
},
securityLevel: "loose",
sequence: {
boxMargin: 8,
useMaxWidth: true,
diagramMarginX: 8,
diagramMarginY: 8,
useMaxWidth: true,
boxMargin: 8
},
startOnLoad: false,
gantt: {
leftPadding: 75,
rightPadding: 20
}
};
if (theme === "dark") {
config.theme = "dark";
config.themeVariables = {
activationBkgColor: "hsl(180, 1.5873015873%, 28.3529411765%)",
activationBorderColor: "#81B1DB",
activeTaskBkgColor: "#81B1DB",
activeTaskBorderColor: "#ffffff",
actorBkg: "#1f2020",
actorBorder: "#81B1DB",
actorLineColor: "lightgrey",
actorTextColor: "lightgrey",
altBackground: "hsl(0, 0%, 40%)",
altSectionBkgColor: "#333",
arrowheadColor: "lightgrey",
background: "#333",
border1: "#81B1DB",
border2: "rgba(255, 255, 255, 0.25)",
classText: "#e0dfdf",
clusterBkg: "hsl(180, 1.5873015873%, 28.3529411765%)",
clusterBorder: "rgba(255, 255, 255, 0.25)",
critBkgColor: "#E83737",
critBorderColor: "#E83737",
darkTextColor: "hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",
defaultLinkColor: "lightgrey",
doneTaskBkgColor: "lightgrey",
doneTaskBorderColor: "grey",
edgeLabelBackground: "hsl(0, 0%, 34.4117647059%)",
errorBkgColor: "#a44141",
errorTextColor: "#ddd",
fillType0: "#1f2020",
fillType1: "hsl(180, 1.5873015873%, 28.3529411765%)",
fillType2: "hsl(244, 1.5873015873%, 12.3529411765%)",
fillType3: "hsl(244, 1.5873015873%, 28.3529411765%)",
fillType4: "hsl(116, 1.5873015873%, 12.3529411765%)",
fillType5: "hsl(116, 1.5873015873%, 28.3529411765%)",
fillType6: "hsl(308, 1.5873015873%, 12.3529411765%)",
fillType7: "hsl(308, 1.5873015873%, 28.3529411765%)",
fontFamily: "\"trebuchet ms\", verdana, arial",
fontSize: "16px",
gridColor: "lightgrey",
labelBackground: "#181818",
labelBoxBkgColor: "#1f2020",
labelBoxBorderColor: "#81B1DB",
labelColor: "#ccc",
labelTextColor: "lightgrey",
lineColor: "lightgrey",
loopTextColor: "lightgrey",
mainBkg: "#1f2020",
mainContrastColor: "lightgrey",
nodeBkg: "#1f2020",
nodeBorder: "#81B1DB",
noteBkgColor: "#fff5ad",
noteBorderColor: "rgba(255, 255, 255, 0.25)",
noteTextColor: "#1f2020",
primaryBorderColor: "hsl(180, 0%, 2.3529411765%)",
primaryColor: "#1f2020",
primaryTextColor: "#e0dfdf",
secondBkg: "hsl(180, 1.5873015873%, 28.3529411765%)",
secondaryBorderColor: "hsl(180, 0%, 18.3529411765%)",
secondaryColor: "hsl(180, 1.5873015873%, 28.3529411765%)",
secondaryTextColor: "rgb(183.8476190475, 181.5523809523, 181.5523809523)",
sectionBkgColor: "hsl(52.9411764706, 28.813559322%, 58.431372549%)",
sectionBkgColor2: "#EAE8D9",
sequenceNumberColor: "black",
signalColor: "lightgrey",
signalTextColor: "lightgrey",
taskBkgColor: "hsl(180, 1.5873015873%, 35.3529411765%)",
taskBorderColor: "#ffffff",
taskTextClickableColor: "#003163",
taskTextColor: "hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",
taskTextDarkColor: "hsl(28.5714285714, 17.3553719008%, 86.2745098039%)",
taskTextLightColor: "lightgrey",
taskTextOutsideColor: "lightgrey",
tertiaryBorderColor: "hsl(20, 0%, 2.3529411765%)",
tertiaryColor: "hsl(20, 1.5873015873%, 12.3529411765%)",
tertiaryTextColor: "rgb(222.9999999999, 223.6666666666, 223.9999999999)",
textColor: "#ccc",
titleColor: "#F9FFFE",
todayLineColor: "#DB5757",
};
}
mermaid.initialize(config);
mermaidElements.forEach((item) => {
Expand Down

0 comments on commit f5ac1b6

Please sign in to comment.