mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +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);
|
||||
|
||||
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) {
|
||||
if (!suggestion.notePath) {
|
||||
return false;
|
||||
|
@ -67,6 +67,9 @@ function showRecentNotes($el) {
|
||||
|
||||
function initNoteAutocomplete($el, options) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user