mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	chore(client/ts): port api_log
This commit is contained in:
		
							parent
							
								
									25cd18f6c8
								
							
						
					
					
						commit
						7e00b889a0
					
				| @ -1,3 +1,5 @@ | |||||||
|  | import type { EventData } from "../components/app_context.js"; | ||||||
|  | import type FNote from "../entities/fnote.js"; | ||||||
| import { t } from "../services/i18n.js"; | import { t } from "../services/i18n.js"; | ||||||
| import NoteContextAwareWidget from "./note_context_aware_widget.js"; | import NoteContextAwareWidget from "./note_context_aware_widget.js"; | ||||||
| 
 | 
 | ||||||
| @ -39,8 +41,12 @@ const TPL = ` | |||||||
| </div>`;
 | </div>`;
 | ||||||
| 
 | 
 | ||||||
| export default class ApiLogWidget extends NoteContextAwareWidget { | export default class ApiLogWidget extends NoteContextAwareWidget { | ||||||
|  | 
 | ||||||
|  |     private $logContainer!: JQuery<HTMLElement>; | ||||||
|  |     private $closeButton!: JQuery<HTMLElement>; | ||||||
|  | 
 | ||||||
|     isEnabled() { |     isEnabled() { | ||||||
|         return this.note && this.note.mime.startsWith("application/javascript;env=") && super.isEnabled(); |         return !!this.note && this.note.mime.startsWith("application/javascript;env=") && super.isEnabled(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     doRender() { |     doRender() { | ||||||
| @ -52,11 +58,11 @@ export default class ApiLogWidget extends NoteContextAwareWidget { | |||||||
|         this.$closeButton.on("click", () => this.toggle(false)); |         this.$closeButton.on("click", () => this.toggle(false)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async refreshWithNote(note) { |     async refreshWithNote(note: FNote) { | ||||||
|         this.$logContainer.empty(); |         this.$logContainer.empty(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     apiLogMessagesEvent({ messages, noteId }) { |     apiLogMessagesEvent({ messages, noteId }: EventData<"apiLogMessages">) { | ||||||
|         if (!this.isNote(noteId)) { |         if (!this.isNote(noteId)) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @ -68,7 +74,7 @@ export default class ApiLogWidget extends NoteContextAwareWidget { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     toggle(show) { |     toggle(show: boolean) { | ||||||
|         this.$widget.toggleClass("hidden-api-log", !show); |         this.$widget.toggleClass("hidden-api-log", !show); | ||||||
|     } |     } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran