mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	clear any event listener added in previous invocation of this function
This commit is contained in:
		
							parent
							
								
									5e2077e6ae
								
							
						
					
					
						commit
						a9a9edf658
					
				| @ -13,8 +13,6 @@ export async function showDialog() { | |||||||
|     utils.openDialog($dialog); |     utils.openDialog($dialog); | ||||||
| 
 | 
 | ||||||
|     noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true }) |     noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true }) | ||||||
|         // clear any event listener added in previous invocation of this function
 |  | ||||||
|         .off('autocomplete:noteselected') |  | ||||||
|         .on('autocomplete:noteselected', function(event, suggestion, dataset) { |         .on('autocomplete:noteselected', function(event, suggestion, dataset) { | ||||||
|             if (!suggestion.notePath) { |             if (!suggestion.notePath) { | ||||||
|                 return false; |                 return false; | ||||||
|  | |||||||
| @ -67,6 +67,9 @@ function showRecentNotes($el) { | |||||||
| 
 | 
 | ||||||
| function initNoteAutocomplete($el, options) { | function initNoteAutocomplete($el, options) { | ||||||
|     if ($el.hasClass("note-autocomplete-input") || utils.isMobile()) { |     if ($el.hasClass("note-autocomplete-input") || utils.isMobile()) { | ||||||
|  |         // clear any event listener added in previous invocation of this function
 | ||||||
|  |         $el.off('autocomplete:noteselected'); | ||||||
|  | 
 | ||||||
|         return $el; |         return $el; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -157,6 +160,9 @@ function initNoteAutocomplete($el, options) { | |||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     // clear any event listener added in previous invocation of this function
 | ||||||
|  |     $el.off('autocomplete:noteselected'); | ||||||
|  | 
 | ||||||
|     return $el; |     return $el; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam