mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 03:10:08 +08:00
feat: Enable conditional settings shortcut based on user preferences
This commit is contained in:
parent
b9b8148fba
commit
4d73ae1eea
@ -1,9 +1,13 @@
|
||||
import { useAppSelector } from '@renderer/store'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
|
||||
const NavigationHandler: React.FC = () => {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const showSettingsShortcutEnabled = useAppSelector(
|
||||
(state) => state.shortcuts.shortcuts.find((s) => s.key === 'show_settings')?.enabled
|
||||
)
|
||||
|
||||
useHotkeys(
|
||||
'meta+, ! ctrl+,',
|
||||
@ -13,7 +17,12 @@ const NavigationHandler: React.FC = () => {
|
||||
}
|
||||
navigate('/settings/provider')
|
||||
},
|
||||
{ splitKey: '!', enableOnContentEditable: true, enableOnFormTags: true }
|
||||
{
|
||||
splitKey: '!',
|
||||
enableOnContentEditable: true,
|
||||
enableOnFormTags: true,
|
||||
enabled: showSettingsShortcutEnabled
|
||||
}
|
||||
)
|
||||
|
||||
return null
|
||||
|
||||
Loading…
Reference in New Issue
Block a user