🐛 Fix: dirty hack for Mermaid loading

This commit is contained in:
Cell
2025-08-14 21:29:12 +08:00
parent e04bb611dc
commit 3c3f6084cc
2 changed files with 26 additions and 14 deletions
+25 -13
View File
@@ -695,21 +695,33 @@ class FixIt {
await loadMermaid();
};
this.switchThemeEventSet.add(() => {
if (processing) {
console.warn('Mermaid is still processing, delaying the reload.');
delayTask = reloadMermaid;
return;
}
// console.log('reload immediately');
reloadMermaid().catch(console.error);
});
const waitForMermaid = () => {
return new Promise((resolve) => {
const timer = setInterval(() => {
if (window.mermaid && window.mermaid.initialize) {
clearInterval(timer);
resolve();
}
}, 100);
});
};
this.beforeprintEventSet.add(() => {
// Optionally set theme to 'neutral' for printing if required
});
waitForMermaid().then(() => {
loadMermaid();
this.switchThemeEventSet.add(() => {
if (processing) {
console.warn('Mermaid is still processing, delaying the reload.');
delayTask = reloadMermaid;
return;
}
// console.log('reload immediately');
reloadMermaid().catch(console.error);
});
loadMermaid();
this.beforeprintEventSet.add(() => {
// Optionally set theme to 'neutral' for printing if required
});
})
}
initEcharts() {
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250814015310-08d3c62b" -}}
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250814132913-e04bb611" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}