feat(mermaid): support ELK diagrams in editor

This commit is contained in:
Elian Doran 2024-11-25 21:32:31 +02:00
parent 482cb46afa
commit e3c8c0c1f2
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,10 @@ const FORCE_GRAPH = {
}; };
const MERMAID = { const MERMAID = {
js: [ "node_modules/mermaid/dist/mermaid.min.js" ] js: [
"node_modules/mermaid/dist/mermaid.min.js",
"libraries/mermaid-elk/elk.min.js"
]
} }
const EXCALIDRAW = { const EXCALIDRAW = {

View File

@ -61,6 +61,7 @@ export default class MermaidWidget extends NoteContextAwareWidget {
const documentStyle = window.getComputedStyle(document.documentElement); const documentStyle = window.getComputedStyle(document.documentElement);
const mermaidTheme = documentStyle.getPropertyValue('--mermaid-theme'); const mermaidTheme = documentStyle.getPropertyValue('--mermaid-theme');
mermaid.registerLayoutLoaders(MERMAID_ELK);
mermaid.mermaidAPI.initialize({ mermaid.mermaidAPI.initialize({
startOnLoad: false, startOnLoad: false,
theme: mermaidTheme.trim(), theme: mermaidTheme.trim(),