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
jump to note list: Use a fixed container instead of dropdown
Elian Doranabbd0b50ebf4
diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.jsindex 526bc6dce6..1cc86f0fed 100644--- a/src/public/app/services/note_autocomplete.js+++ b/src/public/app/services/note_autocomplete.js@@ -137,8 +137,15 @@ function initNoteAutocomplete($el, options) {return false;});+ let autocompleteOptions = {};+ if (options.container) {+ autocompleteOptions.dropdownMenuContainer = options.container;+ } else {+ autocompleteOptions.appendTo = document.querySelector('body');+ }+$el.autocomplete({- appendTo: document.querySelector('body'),+ ...autocompleteOptions,hint: false,autoselect: true,// openOnFocus has to be false, otherwise re-focus (after return from note type chooser dialog) forcesdiff --git a/src/public/app/widgets/dialogs/jump_to_note.js b/src/public/app/widgets/dialogs/jump_to_note.jsindex 385730260f..765d77e22c 100644--- a/src/public/app/widgets/dialogs/jump_to_note.js+++ b/src/public/app/widgets/dialogs/jump_to_note.js@@ -20,6 +20,8 @@ const TPL = `<div class="jump-to-note-dialog modal mx-auto" tabindex="-1" role="<input class="jump-to-note-autocomplete form-control" placeholder="search for note by its name"></div></div>++ <div class="jump-to-note-results"></div></div><div class="modal-footer"><button class="show-in-full-text-button btn btn-sm">Search in full text <kbd>Ctrl+Enter</kbd></button>@@ -40,6 +42,7 @@ export default class JumpToNoteDialog extends BasicWidget {doRender() {this.$widget = $(TPL);this.$autoComplete = this.$widget.find(".jump-to-note-autocomplete");+ this.$results = this.$widget.find(".jump-to-note-results");this.$showInFullTextButton = this.$widget.find(".show-in-full-text-button");this.$showInFullTextButton.on('click', e => this.showInFullText(e));@@ -56,7 +59,10 @@ export default class JumpToNoteDialog extends BasicWidget {}async refresh() {- noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {hideGoToSelectedNoteButton: true})+ noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {+ hideGoToSelectedNoteButton: true,+ container: this.$results+ })// clear any event listener added in previous invocation of this function.off('autocomplete:noteselected').on('autocomplete:noteselected', function (event, suggestion, dataset) {