mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +08:00
feat: 允许功能键(F1-F19)可以被设置为快捷键而不需要修饰键
This commit is contained in:
parent
e4aa2633d1
commit
6541b0b35c
@ -58,8 +58,9 @@ const ShortcutSettings: FC = () => {
|
|||||||
const isValidShortcut = (keys: string[]): boolean => {
|
const isValidShortcut = (keys: string[]): boolean => {
|
||||||
const hasModifier = keys.some((key) => ['Control', 'Ctrl', 'Command', 'Alt', 'Shift'].includes(key))
|
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 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 => {
|
const isDuplicateShortcut = (newShortcut: string[], currentKey: string): boolean => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user