mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-18 16:32:33 +08:00
Triggers full text search when Ctrl + Enter is pressed in autocomplete
This commit is contained in:
parent
693bcfb587
commit
4e10071649
@ -38,6 +38,16 @@ export default class JumpToNoteDialog extends BasicWidget {
|
|||||||
this.modal = bootstrap.Modal.getOrCreateInstance(this.$widget);
|
this.modal = bootstrap.Modal.getOrCreateInstance(this.$widget);
|
||||||
|
|
||||||
this.$autoComplete = this.$widget.find(".jump-to-note-autocomplete");
|
this.$autoComplete = this.$widget.find(".jump-to-note-autocomplete");
|
||||||
|
this.$autoComplete.on('keydown', (event) => {
|
||||||
|
if (event.ctrlKey && event.key === 'Enter') {
|
||||||
|
// Prevent Ctrl + Enter from triggering autoComplete.
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
const searchString = this.$autoComplete.val();
|
||||||
|
appContext.triggerCommand('searchNotes', { searchString });
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
this.$results = this.$widget.find(".jump-to-note-results");
|
this.$results = this.$widget.find(".jump-to-note-results");
|
||||||
this.$showInFullTextButton = this.$widget.find(".show-in-full-text-button");
|
this.$showInFullTextButton = this.$widget.find(".show-in-full-text-button");
|
||||||
this.$showInFullTextButton.on('click', e => this.showInFullText(e));
|
this.$showInFullTextButton.on('click', e => this.showInFullText(e));
|
||||||
|
@ -65,6 +65,18 @@ export default class EmptyTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.$autoComplete = this.$widget.find(".note-autocomplete");
|
this.$autoComplete = this.$widget.find(".note-autocomplete");
|
||||||
|
|
||||||
|
this.$autoComplete.on('keydown', (event) => {
|
||||||
|
if (event.ctrlKey && event.key === 'Enter') {
|
||||||
|
// Prevent Ctrl + Enter from triggering autoComplete.
|
||||||
|
event.stopImmediatePropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
const searchString = this.$autoComplete.val();
|
||||||
|
appContext.triggerCommand('searchNotes', { searchString });
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
this.$results = this.$widget.find(".note-detail-empty-results");
|
this.$results = this.$widget.find(".note-detail-empty-results");
|
||||||
|
|
||||||
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
|
noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
|
||||||
|
@ -922,7 +922,7 @@
|
|||||||
},
|
},
|
||||||
"empty": {
|
"empty": {
|
||||||
"open_note_instruction": "Open a note by typing the note's title into the input below or choose a note in the tree.",
|
"open_note_instruction": "Open a note by typing the note's title into the input below or choose a note in the tree.",
|
||||||
"search_placeholder": "search for a note by its name",
|
"search_placeholder": "search for a note by its name, Ctrl+Enter for full-text search.",
|
||||||
"enter_workspace": "Enter workspace {{title}}"
|
"enter_workspace": "Enter workspace {{title}}"
|
||||||
},
|
},
|
||||||
"file": {
|
"file": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user