fix mermaid
Some checks failed
Deploy / deploy (build, debian, 22, /root/OJDeploy/data/clientnext) (push) Has been cancelled
Deploy / deploy (build:staging, school, 8822, /root/OJ/data/dist) (push) Has been cancelled

This commit is contained in:
2026-05-19 04:46:48 -06:00
parent ef7aa44577
commit 332ab2f966
3 changed files with 227 additions and 248 deletions

View File

@@ -250,11 +250,19 @@ function applyFlowchartDisplayStyle(container: HTMLElement) {
svg.insertBefore(style, svg.firstChild)
}
function getChromeVersion(): number {
const match = navigator.userAgent.match(/Chrome\/(\d+)/)
return match ? parseInt(match[1]) : Infinity
}
let mermaidInstance: any = null
async function loadMermaid() {
if (!mermaidInstance) {
const mermaidModule = await import("mermaid")
const mermaidModule =
getChromeVersion() < 94
? await import("mermaid-legacy")
: await import("mermaid")
mermaidInstance = mermaidModule.default
mermaidInstance.initialize({
startOnLoad: false,