Skip to content

Commit

Permalink
Automatically show recent notes when creating a new tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiriusXT committed Oct 30, 2024
1 parent 0b3654e commit 1ba5130
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/public/app/widgets/type_widgets/empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,15 @@ export default class EmptyTypeWidget extends TypeWidget {
.on('click', () => this.triggerCommand('hoistNote', {noteId: workspaceNote.noteId}))
);
}
noteAutocompleteService.showRecentNotes(this.$autoComplete);
// Automatically trigger autocomplete on focus, which can achieve:
// 1. Automatically display suggestions when $el is focused, without needing to input any text.
// 2. Automatically show recent notes when creating a new tab.
this.$autoComplete.on('focus', () => {
// simulate pressing down arrow to trigger autocomplete
const e = $.Event('keydown');
e.which = 40; // arrow down
this.$autoComplete.trigger(e);
});
this.$autoComplete
.trigger('focus')
.trigger('select');
Expand Down

0 comments on commit 1ba5130

Please sign in to comment.