fix: Restore hotkey edit and remove actions (#11374)

This commit is contained in:
KaniPan
2026-06-23 15:10:26 +09:00
committed by GitHub
parent 6a697edc98
commit e4b108f22c
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ jobs:
if: matrix.build-arch == 'x64'
Windows-Build:
runs-on: windows-latest
runs-on: windows-2022
needs: Lint
strategy:
matrix:
@@ -1,8 +1,8 @@
.item(*ngFor='let hotkey of hotkeys; let i = index')
.body((click)='editItem(i)')
.body((mousedown)='editItem(i, $event)')
.stroke(*ngFor='let stroke of castAny(hotkey.strokes)')
span(*ngIf='!hotkey.isDuplicate') {{stroke}}
span.duplicate(*ngIf='hotkey.isDuplicate') {{stroke}}
.remove((click)='removeItem(i)') ×
.remove((mousedown)='removeItem(i, $event)') ×
.add((click)='addItem()', translate) Add...
@@ -28,6 +28,7 @@
.add {
flex: auto;
opacity: 0;
white-space: nowrap;
&:first-child {
opacity: 1;
@@ -22,7 +22,8 @@ export class MultiHotkeyInputComponent {
this.hotkeys = this.hotkeys.map(hotkey => typeof hotkey.strokes === 'string' ? { ...hotkey, strokes: [hotkey.strokes] } : hotkey)
}
editItem (index: number): void {
editItem (index: number, event?: MouseEvent): void {
if (event && event.button !== 0) { return } // Ignore non-left clicks
this.ngbModal.open(HotkeyInputModalComponent).result.then((newStrokes: string[]) => {
if (this.hotkeys[index]) {
this.hotkeys[index].strokes = newStrokes
@@ -38,7 +39,8 @@ export class MultiHotkeyInputComponent {
})
}
removeItem (index: number): void {
removeItem (index: number, event?: MouseEvent): void {
if (event && event.button !== 0) { return } // Ignore non-left clicks
this.hotkeys = this.hotkeys.filter((_, i) => i !== index)
this.storeUpdatedHotkeys()
}