mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 07:01:31 +08:00 
			
		
		
		
	upgrade mermaid to 10.2.4
This commit is contained in:
		
							parent
							
								
									d4a9461460
								
							
						
					
					
						commit
						332b92791e
					
				
							
								
								
									
										2776
									
								
								libraries/mermaid.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2776
									
								
								libraries/mermaid.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -75,8 +75,9 @@ export default class MermaidWidget extends NoteContextAwareWidget {
 | 
			
		||||
        this.$errorContainer.hide();
 | 
			
		||||
 | 
			
		||||
        try {
 | 
			
		||||
            await this.renderSvg(async renderedSvg => {
 | 
			
		||||
                this.$display.html(renderedSvg);
 | 
			
		||||
            const svg = await this.renderSvg();
 | 
			
		||||
 | 
			
		||||
            this.$display.html(svg);
 | 
			
		||||
 | 
			
		||||
            await wheelZoomLoaded;
 | 
			
		||||
 | 
			
		||||
@ -88,22 +89,20 @@ export default class MermaidWidget extends NoteContextAwareWidget {
 | 
			
		||||
                speed: 20,
 | 
			
		||||
                zoomOnClick: false
 | 
			
		||||
            });
 | 
			
		||||
            });
 | 
			
		||||
        } catch (e) {
 | 
			
		||||
            this.$errorMessage.text(e.message);
 | 
			
		||||
            this.$errorContainer.show();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async renderSvg(cb) {
 | 
			
		||||
    async renderSvg() {
 | 
			
		||||
        idCounter++;
 | 
			
		||||
 | 
			
		||||
        const blob = await this.note.getBlob();
 | 
			
		||||
        const content = blob.content || "";
 | 
			
		||||
 | 
			
		||||
        // this can't be promisified since in case of error, this both calls callback with error SVG and throws exception
 | 
			
		||||
        // with error details
 | 
			
		||||
        mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content, cb);
 | 
			
		||||
        const {svg} = await mermaid.mermaidAPI.render(`mermaid-graph-${idCounter}`, content);
 | 
			
		||||
        return svg;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    async entitiesReloadedEvent({loadResults}) {
 | 
			
		||||
@ -117,9 +116,8 @@ export default class MermaidWidget extends NoteContextAwareWidget {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        await this.renderSvg(renderedSvg => {
 | 
			
		||||
            this.download(`${this.note.title}.svg`, renderedSvg);
 | 
			
		||||
        });
 | 
			
		||||
        const svg = await this.renderSvg();
 | 
			
		||||
        this.download(`${this.note.title}.svg`, svg);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    download(filename, text) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user