mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01: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,19 +75,19 @@ export default class MermaidWidget extends NoteContextAwareWidget { | ||||
|         this.$errorContainer.hide(); | ||||
| 
 | ||||
|         try { | ||||
|             await this.renderSvg(async renderedSvg => { | ||||
|                 this.$display.html(renderedSvg); | ||||
|             const svg = await this.renderSvg(); | ||||
| 
 | ||||
|                 await wheelZoomLoaded; | ||||
|             this.$display.html(svg); | ||||
| 
 | ||||
|                 this.$display.attr("id", `mermaid-render-${idCounter}`); | ||||
|             await wheelZoomLoaded; | ||||
| 
 | ||||
|                 WZoom.create(`#mermaid-render-${idCounter}`, { | ||||
|                     type: 'html', | ||||
|                     maxScale: 10, | ||||
|                     speed: 20, | ||||
|                     zoomOnClick: false | ||||
|                 }); | ||||
|             this.$display.attr("id", `mermaid-render-${idCounter}`); | ||||
| 
 | ||||
|             WZoom.create(`#mermaid-render-${idCounter}`, { | ||||
|                 type: 'html', | ||||
|                 maxScale: 10, | ||||
|                 speed: 20, | ||||
|                 zoomOnClick: false | ||||
|             }); | ||||
|         } catch (e) { | ||||
|             this.$errorMessage.text(e.message); | ||||
| @ -95,15 +95,14 @@ export default class MermaidWidget extends NoteContextAwareWidget { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     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
	 zadam
						zadam