Skip to content

Build your personal knowledge base with Trilium Notes

hide "go to selected note" button in jump because it doesn't make sense there

azivnere44c7c9947fb
diff --git a/src/public/javascripts/dialogs/jump_to_note.js b/src/public/javascripts/dialogs/jump_to_note.js
index 17ec5d29e1..f74fe0e7b6 100644
--- a/src/public/javascripts/dialogs/jump_to_note.js
+++ b/src/public/javascripts/dialogs/jump_to_note.js
@@ -15,15 +15,13 @@ async function showDialog() {
$dialog.modal();
- noteAutocompleteService.initNoteAutocomplete($autoComplete)
+ noteAutocompleteService.initNoteAutocomplete($autoComplete, { hideGoToSelectedNoteButton: true })
.on('autocomplete:selected', function(event, suggestion, dataset) {
if (!suggestion.path) {
return false;
}
treeService.activateNote(suggestion.path);
-
- $dialog.modal('hide');
});
noteAutocompleteService.showRecentNotes($autoComplete);
diff --git a/src/public/javascripts/services/note_autocomplete.js b/src/public/javascripts/services/note_autocomplete.js
index c1e926f926..8396aaf895 100644
--- a/src/public/javascripts/services/note_autocomplete.js
+++ b/src/public/javascripts/services/note_autocomplete.js
@@ -30,8 +30,10 @@ function showRecentNotes($el) {
$el.autocomplete("open");
}
-function initNoteAutocomplete($el) {
+function initNoteAutocomplete($el, options) {
if (!$el.hasClass("note-autocomplete-input")) {
+ options = options || {};
+
$el.addClass("note-autocomplete-input");
const $clearTextButton = $("<span>")
@@ -46,11 +48,16 @@ function initNoteAutocomplete($el) {
.addClass("input-group-text go-to-selected-note-button jam jam-arrow-right")
.prop("title", "Go to selected note");
- $el.after($("<div>")
+ const $sideButtons = $("<div>")
.addClass("input-group-append")
.append($clearTextButton)
- .append($showRecentNotesButton)
- .append($goToSelectedNoteButton));
+ .append($showRecentNotesButton);
+
+ if (!options.hideGoToSelectedNoteButton) {
+ $sideButtons.append($goToSelectedNoteButton);
+ }
+
+ $el.after($sideButtons);
$clearTextButton.click(() => clearText($el));