feat: 允许功能键(F1-F19)可以被设置为快捷键而不需要修饰键

This commit is contained in:
xixiaxixi 2025-04-20 00:13:11 +08:00 committed by 亢奋猫
parent e4aa2633d1
commit 6541b0b35c

View File

@ -58,8 +58,9 @@ const ShortcutSettings: FC = () => {
const isValidShortcut = (keys: string[]): boolean => {
const hasModifier = keys.some((key) => ['Control', 'Ctrl', 'Command', 'Alt', 'Shift'].includes(key))
const hasNonModifier = keys.some((key) => !['Control', 'Ctrl', 'Command', 'Alt', 'Shift'].includes(key))
const hasFnKey = keys.some((key) => /^F\d+$/.test(key))
return hasModifier && hasNonModifier && keys.length >= 2
return (hasModifier && hasNonModifier && keys.length >= 2) || hasFnKey
}
const isDuplicateShortcut = (newShortcut: string[], currentKey: string): boolean => {