LCOV - code coverage report
Current view: top level - src/platform/keybindings/components - EditKeybindingContent.vue Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 83.3 % 6 5
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1           16 : <template>
       2           30 :   <div class="flex w-96 flex-col border-t px-4">
       3              :     <p class="mb-4 text-sm text-muted-foreground">
       4              :       {{ $t('g.setAKeybindingForTheFollowing') }}
       5              :     </p>
       6              :     <div class="mb-4 text-sm">
       7              :       {{ commandLabel }}
       8              :     </div>
       9              : 
      10              :     <input
      11              :       class="mb-4 w-full rounded-sm border bg-secondary px-3 py-2 text-center shadow-none focus:outline-none"
      12              :       :value="dialogState.newCombo?.toString() ?? ''"
      13              :       :placeholder="$t('g.enterYourKeybind')"
      14              :       :aria-label="$t('g.enterYourKeybind')"
      15              :       autocomplete="off"
      16              :       autofocus
      17              :       @keydown.stop.prevent="captureKeybinding"
      18              :     />
      19              :     <div class="min-h-12 text-sm text-destructive">
      20              :       <p v-if="dialogState.newCombo?.isBrowserReserved" class="m-0">
      21              :         {{ $t('g.browserReservedKeybinding') }}
      22              :       </p>
      23              :       <p v-else-if="existingKeybindingOnCombo" class="m-0">
      24              :         {{ $t('g.keybindingAlreadyExists') }}
      25              :         {{ existingKeybindingOnCombo.commandId }}
      26              :       </p>
      27              :     </div>
      28              :   </div>
      29              : </template>
      30              : 
      31              : <script setup lang="ts">
      32              : import type { KeybindingImpl } from '@comfyorg/keybindings/keybinding'
      33              : import { KeyComboImpl } from '@comfyorg/keybindings/keyCombo'
      34              : 
      35              : import type { EditKeybindingDialogState } from '@/platform/keybindings/components/editKeybindingDialogState'
      36              : 
      37              : const { dialogState, onUpdateCombo, existingKeybindingOnCombo } = defineProps<{
      38              :   dialogState: EditKeybindingDialogState
      39              :   commandLabel: string
      40              :   onUpdateCombo: (combo: KeyComboImpl) => void
      41              :   existingKeybindingOnCombo: KeybindingImpl | null
      42              : }>()
      43              : 
      44           17 : function captureKeybinding(event: KeyboardEvent) {
      45           17 :   if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
      46            0 :     if (event.key === 'Escape') return
      47              :   }
      48           17 :   onUpdateCombo(KeyComboImpl.fromEvent(event))
      49              : }
      50              : </script>
        

Generated by: LCOV version 2.0-1