From 201ef7fcd5a8632a546f4c3cd0708bcd56174def Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 9 Aug 2022 21:49:37 +0200 Subject: [PATCH] fix "show recent note" button, closes #3051 --- package-lock.json | 4 ++-- src/public/app/services/note_autocomplete.js | 7 ++++++- src/public/app/widgets/type_widgets/empty.js | 2 -- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index d3ef59b3e..2c239ffd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "trilium", - "version": "0.54.0-beta", + "version": "0.54.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "trilium", - "version": "0.54.0-beta", + "version": "0.54.2", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.js index d7b27f4f3..c84a41dd3 100644 --- a/src/public/app/services/note_autocomplete.js +++ b/src/public/app/services/note_autocomplete.js @@ -5,7 +5,7 @@ import noteCreateService from './note_create.js'; import treeService from './tree.js'; import froca from "./froca.js"; -// this key needs to have this value so it's hit by the tooltip +// this key needs to have this value, so it's hit by the tooltip const SELECTED_NOTE_PATH_KEY = "data-note-path"; const SELECTED_EXTERNAL_LINK_KEY = "data-external-link"; @@ -89,6 +89,11 @@ function showRecentNotes($el) { $el.setSelectedNotePath(""); $el.autocomplete("val", ""); $el.trigger('focus'); + + // simulate pressing down arrow to trigger autocomplete + const e = $.Event('keydown'); + e.which = 40; // arrow down + $el.trigger(e); } function initNoteAutocomplete($el, options) { diff --git a/src/public/app/widgets/type_widgets/empty.js b/src/public/app/widgets/type_widgets/empty.js index 2e3fd97f9..6e4cf8399 100644 --- a/src/public/app/widgets/type_widgets/empty.js +++ b/src/public/app/widgets/type_widgets/empty.js @@ -63,8 +63,6 @@ export default class EmptyTypeWidget extends TypeWidget { appContext.tabManager.getActiveContext().setNote(suggestion.notePath); }); - noteAutocompleteService.showRecentNotes(this.$autoComplete); - this.$workspaceNotes = this.$widget.find('.workspace-notes'); super.doRender();