|
|
|
|
@ -59,21 +59,9 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|
|
|
|
|
|
|
|
|
await libraryLoader.requireLibrary(libraryLoader.MERMAID);
|
|
|
|
|
|
|
|
|
|
const documentStyle = window.getComputedStyle(document.documentElement);
|
|
|
|
|
const mermaidTheme = documentStyle.getPropertyValue('--mermaid-theme');
|
|
|
|
|
|
|
|
|
|
mermaid.mermaidAPI.initialize({
|
|
|
|
|
startOnLoad: false,
|
|
|
|
|
theme: mermaidTheme.trim(),
|
|
|
|
|
securityLevel: 'antiscript',
|
|
|
|
|
flow: { useMaxWidth: false },
|
|
|
|
|
sequence: { useMaxWidth: false },
|
|
|
|
|
gantt: { useMaxWidth: false },
|
|
|
|
|
"class": { useMaxWidth: false },
|
|
|
|
|
state: { useMaxWidth: false },
|
|
|
|
|
pie: { useMaxWidth: true },
|
|
|
|
|
journey: { useMaxWidth: false },
|
|
|
|
|
git: { useMaxWidth: false },
|
|
|
|
|
...getMermaidConfig()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$display.empty();
|
|
|
|
|
@ -146,3 +134,21 @@ export default class MermaidWidget extends NoteContextAwareWidget {
|
|
|
|
|
utils.downloadSvg(this.note.title, svg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function getMermaidConfig() {
|
|
|
|
|
const documentStyle = window.getComputedStyle(document.documentElement);
|
|
|
|
|
const mermaidTheme = documentStyle.getPropertyValue('--mermaid-theme');
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
theme: mermaidTheme.trim(),
|
|
|
|
|
securityLevel: 'antiscript',
|
|
|
|
|
flow: { useMaxWidth: false },
|
|
|
|
|
sequence: { useMaxWidth: false },
|
|
|
|
|
gantt: { useMaxWidth: false },
|
|
|
|
|
"class": { useMaxWidth: false },
|
|
|
|
|
state: { useMaxWidth: false },
|
|
|
|
|
pie: { useMaxWidth: true },
|
|
|
|
|
journey: { useMaxWidth: false },
|
|
|
|
|
git: { useMaxWidth: false },
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|