| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  | import FlexContainer from "./containers/flex_container.js"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default class NoteWrapperWidget extends FlexContainer { | 
					
						
							|  |  |  |     constructor() { | 
					
						
							|  |  |  |         super('column'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.css("flex-grow", "1") | 
					
						
							|  |  |  |             .collapsible(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     doRender() { | 
					
						
							|  |  |  |         super.doRender(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.$widget.addClass("note-split"); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     setNoteContextEvent({noteContext}) { | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |         this.noteContext = noteContext; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         this.refresh(); | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |     noteSwitchedAndActivatedEvent() { | 
					
						
							|  |  |  |         this.refresh(); | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |     noteSwitchedEvent() { | 
					
						
							|  |  |  |         this.refresh(); | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |     activeContextChangedEvent() { | 
					
						
							|  |  |  |         this.refresh(); | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |     refresh() { | 
					
						
							|  |  |  |         const note = this.noteContext?.note; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |         this.$widget.toggleClass("full-content-width", | 
					
						
							| 
									
										
										
										
											2022-05-30 20:59:54 +02:00
										 |  |  |             ['image', 'mermaid', 'book', 'render', 'canvas', 'web-view'].includes(note?.type) | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  |             || !!note?.hasLabel('fullContentWidth') | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  |         ); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-05-22 14:24:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     async entitiesReloadedEvent({loadResults}) { | 
					
						
							|  |  |  |         // listening on changes of note.type
 | 
					
						
							|  |  |  |         if (loadResults.isNoteReloaded(this.noteContext?.noteId)) { | 
					
						
							|  |  |  |             this.refresh(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2021-11-24 21:27:55 +01:00
										 |  |  | } |