mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 07:38:53 +02:00
fix(command_palette): not showing after re-entering
This commit is contained in:
parent
757488a95b
commit
82e16a5624
@ -54,7 +54,7 @@ export default class JumpToNoteDialog extends BasicWidget {
|
|||||||
this.$modalFooter.find(".show-in-full-text-button").on("click", (e) => this.showInFullText(e));
|
this.$modalFooter.find(".show-in-full-text-button").on("click", (e) => this.showInFullText(e));
|
||||||
|
|
||||||
shortcutService.bindElShortcut(this.$widget, "ctrl+return", (e) => this.showInFullText(e));
|
shortcutService.bindElShortcut(this.$widget, "ctrl+return", (e) => this.showInFullText(e));
|
||||||
|
|
||||||
// Monitor input changes to detect command mode switches
|
// Monitor input changes to detect command mode switches
|
||||||
this.$autoComplete.on("input", () => {
|
this.$autoComplete.on("input", () => {
|
||||||
this.updateCommandModeState();
|
this.updateCommandModeState();
|
||||||
@ -64,7 +64,7 @@ export default class JumpToNoteDialog extends BasicWidget {
|
|||||||
private updateCommandModeState() {
|
private updateCommandModeState() {
|
||||||
const currentValue = String(this.$autoComplete.val() || "");
|
const currentValue = String(this.$autoComplete.val() || "");
|
||||||
const newCommandMode = currentValue.startsWith(">");
|
const newCommandMode = currentValue.startsWith(">");
|
||||||
|
|
||||||
if (newCommandMode !== this.isCommandMode) {
|
if (newCommandMode !== this.isCommandMode) {
|
||||||
this.isCommandMode = newCommandMode;
|
this.isCommandMode = newCommandMode;
|
||||||
this.updateButtonVisibility();
|
this.updateButtonVisibility();
|
||||||
@ -152,10 +152,10 @@ export default class JumpToNoteDialog extends BasicWidget {
|
|||||||
this.$autoComplete.autocomplete("val", ">");
|
this.$autoComplete.autocomplete("val", ">");
|
||||||
this.isCommandMode = true;
|
this.isCommandMode = true;
|
||||||
this.updateButtonVisibility();
|
this.updateButtonVisibility();
|
||||||
|
|
||||||
// Manually populate with all commands immediately
|
// Manually populate with all commands immediately
|
||||||
noteAutocompleteService.showAllCommands(this.$autoComplete);
|
noteAutocompleteService.showAllCommands(this.$autoComplete);
|
||||||
|
|
||||||
this.$autoComplete.trigger("focus");
|
this.$autoComplete.trigger("focus");
|
||||||
} else {
|
} else {
|
||||||
// if you open the Jump To dialog soon after using it previously, it can often mean that you
|
// 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())
|
.autocomplete("val", this.$autoComplete.next().text())
|
||||||
.trigger("focus")
|
.trigger("focus")
|
||||||
.trigger("select");
|
.trigger("select");
|
||||||
|
|
||||||
// Update command mode state based on the restored value
|
// Update command mode state based on the restored value
|
||||||
this.updateCommandModeState();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user