From 82e16a5624311b509becd922c21e6d3b58ef08eb Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 27 Jul 2025 20:31:13 +0300 Subject: [PATCH] fix(command_palette): not showing after re-entering --- apps/client/src/widgets/dialogs/jump_to_note.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/client/src/widgets/dialogs/jump_to_note.ts b/apps/client/src/widgets/dialogs/jump_to_note.ts index d56257f29..abadde0d3 100644 --- a/apps/client/src/widgets/dialogs/jump_to_note.ts +++ b/apps/client/src/widgets/dialogs/jump_to_note.ts @@ -54,7 +54,7 @@ export default class JumpToNoteDialog extends BasicWidget { this.$modalFooter.find(".show-in-full-text-button").on("click", (e) => this.showInFullText(e)); shortcutService.bindElShortcut(this.$widget, "ctrl+return", (e) => this.showInFullText(e)); - + // Monitor input changes to detect command mode switches this.$autoComplete.on("input", () => { this.updateCommandModeState(); @@ -64,7 +64,7 @@ export default class JumpToNoteDialog extends BasicWidget { private updateCommandModeState() { const currentValue = String(this.$autoComplete.val() || ""); const newCommandMode = currentValue.startsWith(">"); - + if (newCommandMode !== this.isCommandMode) { this.isCommandMode = newCommandMode; this.updateButtonVisibility(); @@ -152,10 +152,10 @@ export default class JumpToNoteDialog extends BasicWidget { this.$autoComplete.autocomplete("val", ">"); this.isCommandMode = true; this.updateButtonVisibility(); - + // 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 @@ -173,9 +173,16 @@ export default class JumpToNoteDialog extends BasicWidget { .autocomplete("val", this.$autoComplete.next().text()) .trigger("focus") .trigger("select"); - + // Update command mode state based on the restored value this.updateCommandModeState(); + + // If we restored a command mode value, manually trigger command display + if (this.isCommandMode) { + // Clear the value first, then set it to ">" to trigger a proper change + this.$autoComplete.autocomplete("val", ""); + noteAutocompleteService.showAllCommands(this.$autoComplete); + } } } }