Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
Fix can't type in palette bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmandKrynauw committed Jul 26, 2023
1 parent 1bb3bc5 commit 1317560
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions src/frontend/ui/base/palette/Palette.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Shortcuts from "../../utils/Shortcuts.svelte";
let showPalette = false;
let expanded = false;
let expanded = true;
let inputElement: HTMLInputElement;
let searchTerm = "";
Expand Down Expand Up @@ -118,15 +118,31 @@
}
}
function openPalette() {
showPalette = true;
searchTerm = "";
selectedCategory = 0;
selectedItem = 0;
categories = categoriesOriginals;
}
function closePalette() {
showPalette = false;
}
const shortcuts = {
"blix.palette.toggle": () => {
showPalette = !showPalette;
if (showPalette) {
closePalette();
} else {
openPalette();
}
},
"blix.palette.show": () => {
showPalette = true;
openPalette();
},
"blix.palette.hide": () => {
showPalette = false;
closePalette();
},
"blix.palette.scrollDown": () => {
selectedItem++;
Expand All @@ -151,16 +167,11 @@
commandStore.runCommand(item.id);
}
$: if (showPalette && inputElement) {
inputElement.focus();
}
$: inputElement?.focus();
$: if (showPalette) {
searchTerm = "";
expanded = true;
selectedCategory = 0;
selectedItem = 0;
categories = categoriesOriginals;
$: {
selectedCategory;
selectedItem;
repairItemIndex();
}
</script>
Expand Down

0 comments on commit 1317560

Please sign in to comment.