mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	updated react unmounting
This commit is contained in:
		
							parent
							
								
									bd28ed07d7
								
							
						
					
					
						commit
						a33b0f1e1c
					
				| @ -66,18 +66,13 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|                 const React = window.React; |                 const React = window.React; | ||||||
|                 const ReactDOM = window.ReactDOM; |                 const ReactDOM = window.ReactDOM; | ||||||
|                  |                  | ||||||
|  |                 ReactDOM.unmountComponentAtNode(excalidrawWrapper); | ||||||
|                 ReactDOM.render(React.createElement(this.ExcalidrawReactApp), excalidrawWrapper); |                 ReactDOM.render(React.createElement(this.ExcalidrawReactApp), excalidrawWrapper); | ||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|         return this.$widget; |         return this.$widget; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async refreshWithNote(note) { |  | ||||||
|         const noteComplement = await froca.getNoteComplement(note.noteId); |  | ||||||
|         const content = noteComplement.content || ""; |  | ||||||
|         console.log('refreshWithNote(note) called', content); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     /** |     /** | ||||||
|      * called to populate the widget container with the note content |      * called to populate the widget container with the note content | ||||||
|      *  |      *  | ||||||
| @ -87,6 +82,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|         console.log('doRefresh()', note); |         console.log('doRefresh()', note); | ||||||
|         // get note from backend and put into canvas
 |         // get note from backend and put into canvas
 | ||||||
|          |          | ||||||
|  |         // wait for react to have rendered!
 | ||||||
|         console.log('sleep 1s...'); |         console.log('sleep 1s...'); | ||||||
|         await sleep(1000); |         await sleep(1000); | ||||||
| 
 | 
 | ||||||
| @ -138,6 +134,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     onChangeHandler() { |     onChangeHandler() { | ||||||
|  |         console.log("onChangeHandler() =================", new Date()); | ||||||
|         this.saveData(); |         this.saveData(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -200,7 +197,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | |||||||
|                     //         self.saveData();
 |                     //         self.saveData();
 | ||||||
|                     //     }, 400);
 |                     //     }, 400);
 | ||||||
|                     // },
 |                     // },
 | ||||||
|                     onChange: debounce(self.onChangeHandler, 500), |                     onChange: debounce(self.onChangeHandler, 750), | ||||||
|                     // onPointerUpdate: (payload) => console.log(payload),
 |                     // onPointerUpdate: (payload) => console.log(payload),
 | ||||||
|                     onCollabButtonClick: () => { |                     onCollabButtonClick: () => { | ||||||
|                         window.alert("You clicked on collab button") |                         window.alert("You clicked on collab button") | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom
						Tom