From db79f231a0d731962a848430b5e48015a344c83c Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Wed, 13 Nov 2024 17:13:07 +0800 Subject: [PATCH] Triggers full text search when Ctrl + Enter is pressed in note_autocomplete --- src/public/app/services/note_autocomplete.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.js index dbee214b7b..5932e6177e 100644 --- a/src/public/app/services/note_autocomplete.js +++ b/src/public/app/services/note_autocomplete.js @@ -132,6 +132,19 @@ function initNoteAutocomplete($el, options) { return false; }); + // Triggers full text search when Ctrl + Enter is pressed. + $el.on('keydown', (event) => { + if (event.key === 'Enter') { + if (event.ctrlKey) { + // Prevent Ctrl + Enter from triggering autoComplete. + event.preventDefault(); + event.stopImmediatePropagation(); + const searchString = $el.val(); + appContext.triggerCommand('searchNotes', { searchString }); + } + } + }); + let autocompleteOptions = {}; if (options.container) { autocompleteOptions.dropdownMenuContainer = options.container;