mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	remove some debug/testing code
This commit is contained in:
		
							parent
							
								
									4266156cee
								
							
						
					
					
						commit
						15a3b42124
					
				| @ -6,7 +6,6 @@ import froca from "../../services/froca.js"; | |||||||
| import debounce from "./canvas-note-utils/lodash.debounce.js"; | import debounce from "./canvas-note-utils/lodash.debounce.js"; | ||||||
| import uniqueId from "./canvas-note-utils/lodash.uniqueId.js"; | import uniqueId from "./canvas-note-utils/lodash.uniqueId.js"; | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|  // NoteContextAwareWidget does not handle loading/refreshing of note context
 |  // NoteContextAwareWidget does not handle loading/refreshing of note context
 | ||||||
| import NoteContextAwareWidget from "../note_context_aware_widget.js"; | import NoteContextAwareWidget from "../note_context_aware_widget.js"; | ||||||
| 
 | 
 | ||||||
| @ -68,9 +67,8 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|         this.isNewSceneVersion = this.isNewSceneVersion.bind(this); |         this.isNewSceneVersion = this.isNewSceneVersion.bind(this); | ||||||
|         this.updateSceneVersion = this.updateSceneVersion.bind(this); |         this.updateSceneVersion = this.updateSceneVersion.bind(this); | ||||||
|         this.getSceneVersion = this.getSceneVersion.bind(this); |         this.getSceneVersion = this.getSceneVersion.bind(this); | ||||||
|         this.test = this.test.bind(this); |  | ||||||
| 
 | 
 | ||||||
|         // debugging helper
 |         // debugging helper - delete this block or comment
 | ||||||
|         this.uniqueId = uniqueId(); |         this.uniqueId = uniqueId(); | ||||||
|         console.log("uniqueId", this.uniqueId); |         console.log("uniqueId", this.uniqueId); | ||||||
|         if (!window.triliumexcalidraw) { |         if (!window.triliumexcalidraw) { | ||||||
| @ -80,47 +78,19 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|         // end debug 
 |         // end debug 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     test() { |     /** | ||||||
|         /** |      * (trilium) | ||||||
|          * exportToSvg({ |      *  | ||||||
|             elements: ExcalidrawElement[], |      * @returns {string} "canvas-note" | ||||||
|             appState: AppState, |      */ | ||||||
|             exportPadding?: number, = 10 defualt |  | ||||||
|             metadata?: string, // no function!?
 |  | ||||||
|             files?: BinaryFiles |  | ||||||
|             }) |  | ||||||
|          */ |  | ||||||
|         const elements = this.excalidrawRef.current.getSceneElements(); |  | ||||||
|         const appState = this.excalidrawRef.current.getAppState(); |  | ||||||
|         const files = this.excalidrawRef.current.getFiles(); |  | ||||||
|         const data = { |  | ||||||
|             elements,  |  | ||||||
|             appState,  |  | ||||||
|             files,  |  | ||||||
|             exportPadding: 5, // padding [px] of svg "image"
 |  | ||||||
|         } |  | ||||||
|         const svg = window.Excalidraw.exportToSvg(data); |  | ||||||
| 
 |  | ||||||
|         console.log("test", data, svg); |  | ||||||
| 
 |  | ||||||
|         return svg; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     static getType() { |     static getType() { | ||||||
|         return "canvas-note"; |         return "canvas-note"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     log(...args) { |     /** | ||||||
|         let title = ''; |      * (trilium) | ||||||
|         if (this.note) { |      * renders note | ||||||
|             title = this.note.title; |      */ | ||||||
|         } else { |  | ||||||
|             title = this.noteId + "nt/na"; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         console.log(title, "=", this.noteId, "==",  ...args); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
| 
 | 
 | ||||||
| @ -149,6 +119,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  |      * (trilium) | ||||||
|      * called to populate the widget container with the note content |      * called to populate the widget container with the note content | ||||||
|      *  |      *  | ||||||
|      * @param {note} note  |      * @param {note} note  | ||||||
| @ -160,12 +131,10 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
| 
 | 
 | ||||||
|         /** |         /** | ||||||
|          * before we load content into excalidraw, make sure excalidraw has loaded |          * before we load content into excalidraw, make sure excalidraw has loaded | ||||||
|          *  |  | ||||||
|          * FIXME: better a loop? |  | ||||||
|          */ |          */ | ||||||
|         while (!this.excalidrawRef) { |         while (!this.excalidrawRef) { | ||||||
|             this.log("doRefresh !!!!!!!!!!! excalidrawref not yet loeaded, sleep 1s..."); |             this.log("doRefresh! excalidrawref not yet loeaded, sleep 200ms..."); | ||||||
|             await sleep(100); |             await sleep(200); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (this.excalidrawRef.current && noteComplement.content) { |         if (this.excalidrawRef.current && noteComplement.content) { | ||||||
| @ -396,4 +365,20 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|     updateSceneVersion() { |     updateSceneVersion() { | ||||||
|         this.currentSceneVersion = this.getSceneVersion(); |         this.currentSceneVersion = this.getSceneVersion(); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      * logs to console.log with some predefined title | ||||||
|  |      *  | ||||||
|  |      * @param  {...any} args  | ||||||
|  |      */ | ||||||
|  |     log(...args) { | ||||||
|  |         let title = ''; | ||||||
|  |         if (this.note) { | ||||||
|  |             title = this.note.title; | ||||||
|  |         } else { | ||||||
|  |             title = this.noteId + "nt/na"; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         console.log(title, "=", this.noteId, "==",  ...args); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom
						Tom