Add reset individual keybind button (#3423)

Co-authored-by: Benjamin Lu <templu1107@proton.me>
This commit is contained in:
Benjamin Lu
2025-04-12 16:59:00 -04:00
committed by GitHub
parent 731ce8599d
commit c8b8953e0a
3 changed files with 195 additions and 0 deletions

View File

@@ -27,6 +27,14 @@
class="p-button-text"
@click="editKeybinding(slotProps.data)"
/>
<Button
icon="pi pi-replay"
class="p-button-text p-button-warn"
:disabled="
!keybindingStore.isCommandKeybindingModified(slotProps.data.id)
"
@click="resetKeybinding(slotProps.data)"
/>
<Button
icon="pi pi-trash"
class="p-button-text p-button-danger"
@@ -254,6 +262,16 @@ async function saveKeybinding() {
cancelEdit()
}
async function resetKeybinding(commandData: ICommandData) {
if (keybindingStore.resetKeybindingForCommand(commandData.id)) {
await keybindingService.persistUserKeybindings()
} else {
console.warn(
`No changes made when resetting keybinding for command: ${commandData.id}`
)
}
}
const toast = useToast()
async function resetAllKeybindings() {
keybindingStore.resetAllKeybindings()