From 126152ff6331a4676202987e4c614dfaad22d500 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 27 Jul 2025 15:42:44 +0300 Subject: [PATCH] feat(command_palette): display commands immediately --- apps/client/src/services/note_autocomplete.ts | 7 +++++++ apps/client/src/widgets/dialogs/jump_to_note.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/client/src/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.ts index cf05be465..8b5314604 100644 --- a/apps/client/src/services/note_autocomplete.ts +++ b/apps/client/src/services/note_autocomplete.ts @@ -187,6 +187,12 @@ function showRecentNotes($el: JQuery) { $el.trigger("focus"); } +function showAllCommands($el: JQuery) { + searchDelay = 0; + $el.setSelectedNotePath(""); + $el.autocomplete("val", ">").autocomplete("open"); +} + function fullTextSearch($el: JQuery, options: Options) { const searchString = $el.autocomplete("val") as unknown as string; if (options.fastSearch === false || searchString?.trim().length === 0) { @@ -459,6 +465,7 @@ export default { autocompleteSourceForCKEditor, initNoteAutocomplete, showRecentNotes, + showAllCommands, setText, init }; diff --git a/apps/client/src/widgets/dialogs/jump_to_note.ts b/apps/client/src/widgets/dialogs/jump_to_note.ts index 9c93fbf00..2b8638e63 100644 --- a/apps/client/src/widgets/dialogs/jump_to_note.ts +++ b/apps/client/src/widgets/dialogs/jump_to_note.ts @@ -124,11 +124,13 @@ export default class JumpToNoteDialog extends BasicWidget { }); if (commandMode) { - // Start in command mode - this.$autoComplete - .autocomplete("val", ">") - .trigger("focus") - .trigger("select"); + // Start in command mode - manually trigger command search + this.$autoComplete.autocomplete("val", ">"); + + // Manually populate with all commands immediately + noteAutocompleteService.showAllCommands(this.$autoComplete); + + this.$autoComplete.trigger("focus"); } else { // if you open the Jump To dialog soon after using it previously, it can often mean that you // actually want to search for the same thing (e.g., you opened the wrong note at first try)