Triggers full text search when Ctrl + Enter is pressed in note_autocomplete

This commit is contained in:
SiriusXT 2024-11-13 17:13:07 +08:00
parent 693bcfb587
commit db79f231a0

View File

@ -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;