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