| 
									
										
										
										
											2020-04-26 09:40:02 +02:00
										 |  |  | import CollapsibleWidget from "../collapsible_widget.js"; | 
					
						
							| 
									
										
										
										
											2019-08-15 21:18:33 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  | const TPL = `
 | 
					
						
							| 
									
										
										
										
											2020-01-21 22:08:41 +01:00
										 |  |  | <table class="note-info-widget-table"> | 
					
						
							|  |  |  |     <style> | 
					
						
							|  |  |  |         .note-info-widget-table { | 
					
						
							|  |  |  |             table-layout: fixed;  | 
					
						
							|  |  |  |             width: 100%; | 
					
						
							|  |  |  |         }  | 
					
						
							|  |  |  |     | 
					
						
							|  |  |  |         .note-info-widget-table td, .note-info-widget-table th { | 
					
						
							|  |  |  |             padding: 5px; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-03-01 19:06:26 +01:00
										 |  |  |          | 
					
						
							|  |  |  |         .note-info-mime { | 
					
						
							|  |  |  |             max-width: 13em; | 
					
						
							|  |  |  |             overflow: hidden; | 
					
						
							|  |  |  |             text-overflow: ellipsis; | 
					
						
							|  |  |  |             white-space: nowrap; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2020-01-21 22:08:41 +01:00
										 |  |  |     </style> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |     <tr> | 
					
						
							| 
									
										
										
										
											2020-05-06 17:12:28 -04:00
										 |  |  |         <th>Note ID:</th> | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  |         <td nowrap colspan="3" class="note-info-note-id"></td> | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |     </tr> | 
					
						
							|  |  |  |     <tr> | 
					
						
							| 
									
										
										
										
											2020-05-06 17:12:28 -04:00
										 |  |  |         <th>Created:</th> | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  |         <td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-created"></td> | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |     </tr> | 
					
						
							|  |  |  |     <tr> | 
					
						
							| 
									
										
										
										
											2020-05-06 17:12:28 -04:00
										 |  |  |         <th>Modified:</th> | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  |         <td nowrap colspan="3" style="overflow: hidden; text-overflow: ellipsis;" class="note-info-date-modified"></td> | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |     </tr> | 
					
						
							|  |  |  |     <tr> | 
					
						
							| 
									
										
										
										
											2019-09-01 09:16:08 +02:00
										 |  |  |         <th>Type:</th> | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |         <td class="note-info-type"></td> | 
					
						
							| 
									
										
										
										
											2019-09-01 09:16:08 +02:00
										 |  |  |          | 
					
						
							|  |  |  |         <th>MIME:</th> | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |         <td class="note-info-mime"></td> | 
					
						
							|  |  |  |     </tr> | 
					
						
							|  |  |  | </table> | 
					
						
							|  |  |  | `;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 21:16:20 +01:00
										 |  |  | export default class NoteInfoWidget extends CollapsibleWidget { | 
					
						
							| 
									
										
										
										
											2020-03-16 22:14:18 +01:00
										 |  |  |     get widgetTitle() { return "Note info"; } | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-29 19:43:19 +01:00
										 |  |  |     async doRenderBody() { | 
					
						
							| 
									
										
										
										
											2019-08-15 21:18:33 +02:00
										 |  |  |         this.$body.html(TPL); | 
					
						
							| 
									
										
										
										
											2020-02-02 18:46:50 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         this.$noteId = this.$body.find(".note-info-note-id"); | 
					
						
							|  |  |  |         this.$dateCreated = this.$body.find(".note-info-date-created"); | 
					
						
							|  |  |  |         this.$dateModified = this.$body.find(".note-info-date-modified"); | 
					
						
							|  |  |  |         this.$type = this.$body.find(".note-info-type"); | 
					
						
							|  |  |  |         this.$mime = this.$body.find(".note-info-mime"); | 
					
						
							| 
									
										
										
										
											2020-01-14 21:23:32 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-01 11:33:31 +01:00
										 |  |  |     async refreshWithNote(note) { | 
					
						
							|  |  |  |         const noteComplement = await this.tabContext.getNoteComplement(); | 
					
						
							| 
									
										
										
										
											2020-01-25 14:37:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 18:46:50 +01:00
										 |  |  |         this.$noteId.text(note.noteId); | 
					
						
							|  |  |  |         this.$dateCreated | 
					
						
							| 
									
										
										
										
											2020-02-01 11:15:58 +01:00
										 |  |  |             .text(noteComplement.dateCreated) | 
					
						
							|  |  |  |             .attr("title", noteComplement.dateCreated); | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 18:46:50 +01:00
										 |  |  |         this.$dateModified | 
					
						
							| 
									
										
										
										
											2020-02-01 11:15:58 +01:00
										 |  |  |             .text(noteComplement.dateModified) | 
					
						
							|  |  |  |             .attr("title", noteComplement.dateCreated); | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 18:46:50 +01:00
										 |  |  |         this.$type.text(note.type); | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-02 18:46:50 +01:00
										 |  |  |         this.$mime | 
					
						
							| 
									
										
										
										
											2020-01-04 09:04:08 +01:00
										 |  |  |             .text(note.mime) | 
					
						
							|  |  |  |             .attr("title", note.mime); | 
					
						
							| 
									
										
										
										
											2019-07-21 11:32:38 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-08-06 22:39:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-16 19:23:49 +01:00
										 |  |  |     entitiesReloadedEvent({loadResults}) { | 
					
						
							| 
									
										
										
										
											2020-02-02 21:16:20 +01:00
										 |  |  |         if (loadResults.isNoteReloaded(this.noteId)) { | 
					
						
							| 
									
										
										
										
											2020-01-18 20:49:49 +01:00
										 |  |  |             this.refresh(); | 
					
						
							| 
									
										
										
										
											2019-08-06 22:39:27 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2020-05-06 17:12:28 -04:00
										 |  |  | } |