MCPcopy Index your code
hub / github.com/ZToolsCenter/ZTools / normalizeKey

Method normalizeKey

src/main/managers/windowManager.ts:1449–1479  ·  view source on GitHub ↗

* 标准化按键名称

(key: string)

Source from the content-addressed store, hash-verified

1447 * 标准化按键名称
1448 */
1449 private normalizeKey(key: string): string {
1450 // 字母转大写
1451 if (key.length === 1 && /[a-z]/.test(key)) {
1452 return key.toUpperCase()
1453 }
1454
1455 // 数字键
1456 if (key.length === 1 && /[0-9]/.test(key)) {
1457 return key
1458 }
1459
1460 // 特殊键映射
1461 const keyMap: Record<string, string> = {
1462 ' ': 'Space',
1463 Enter: 'Enter',
1464 Escape: 'Escape',
1465 Tab: 'Tab',
1466 Backspace: 'Backspace',
1467 Delete: 'Delete',
1468 ArrowUp: 'Up',
1469 ArrowDown: 'Down',
1470 ArrowLeft: 'Left',
1471 ArrowRight: 'Right',
1472 Home: 'Home',
1473 End: 'End',
1474 PageUp: 'PageUp',
1475 PageDown: 'PageDown'
1476 }
1477
1478 return keyMap[key] || key
1479 }
1480
1481 /**
1482 * 处理应用快捷键触发

Callers 1

buildShortcutStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected