Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
open recent notes autocomplete by focus so it is then closed with blur, fixes #272
azivner0b251530fa0e
diff --git a/src/public/javascripts/dialogs/jump_to_note.js b/src/public/javascripts/dialogs/jump_to_note.jsindex f74fe0e7b6..063434d2aa 100644--- a/src/public/javascripts/dialogs/jump_to_note.js+++ b/src/public/javascripts/dialogs/jump_to_note.js@@ -6,8 +6,6 @@ const $dialog = $("#jump-to-note-dialog");const $autoComplete = $("#jump-to-note-autocomplete");const $showInFullTextButton = $("#show-in-full-text-button");-$dialog.on("shown.bs.modal", e => $autoComplete.focus());-async function showDialog() {glob.activeDialog = $dialog;diff --git a/src/public/javascripts/services/note_autocomplete.js b/src/public/javascripts/services/note_autocomplete.jsindex 00bf55f3b5..fd7f166c9c 100644--- a/src/public/javascripts/services/note_autocomplete.js+++ b/src/public/javascripts/services/note_autocomplete.js@@ -28,7 +28,7 @@ function clearText($el) {function showRecentNotes($el) {$el.setSelectedPath("");$el.autocomplete("val", "");- $el.autocomplete("open");+ $el.focus();}function initNoteAutocomplete($el, options) {@@ -61,7 +61,13 @@ function initNoteAutocomplete($el, options) {$clearTextButton.click(() => clearText($el));- $showRecentNotesButton.click(() => showRecentNotes($el));+ $showRecentNotesButton.click(e => {+ showRecentNotes($el);++ // this will cause the click not give focus to the "show recent notes" button+ // this is important because otherwise input will lose focus immediatelly and not show the results+ return false;+ });$goToSelectedNoteButton.click(() => {if ($el.hasClass("disabled")) {diff --git a/src/public/javascripts/services/search_notes.js b/src/public/javascripts/services/search_notes.jsindex ecb4deb0e3..916391960e 100644--- a/src/public/javascripts/services/search_notes.js+++ b/src/public/javascripts/services/search_notes.js@@ -87,7 +87,7 @@ $searchInput.keyup(e => {if (e && e.which === $.ui.keyCode.ENTER) {doSearch();}-}).focus();+});$doSearchButton.click(() => doSearch()); // keep long form because of argument$resetSearchButton.click(resetSearch);