Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/public/app/widgets/dialogs/jump_to_note.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ export default class JumpToNoteDialog extends BasicWidget {
this.modal = bootstrap.Modal.getOrCreateInstance(this.$widget);

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.$showInFullTextButton = this.$widget.find(".show-in-full-text-button");
this.$showInFullTextButton.on('click', e => this.showInFullText(e));
Expand Down
12 changes: 12 additions & 0 deletions src/public/app/widgets/type_widgets/empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ export default class EmptyTypeWidget extends TypeWidget {

this.$widget = $(TPL);
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");

noteAutocompleteService.initNoteAutocomplete(this.$autoComplete, {
Expand Down
2 changes: 1 addition & 1 deletion src/public/translations/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@
},
"empty": {
"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}}"
},
"file": {
Expand Down