mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	feat(mermaid): support ELK diagrams in editor
This commit is contained in:
		
							parent
							
								
									482cb46afa
								
							
						
					
					
						commit
						e3c8c0c1f2
					
				@ -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 = {
 | 
				
			||||||
 | 
				
			|||||||
@ -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(),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user