({ config, update, loadConfig }: ShortcutSectionProps)
| 9 | } |
| 10 | |
| 11 | export default function ShortcutSection({ config, update, loadConfig }: ShortcutSectionProps) { |
| 12 | return ( |
| 13 | <div className="card settings-grid-full"> |
| 14 | <div className="settings-group"> |
| 15 | <div className="settings-group-title">快捷键</div> |
| 16 | |
| 17 | <div className="settings-item"> |
| 18 | <div className="settings-item-info"> |
| 19 | <div className="settings-item-title">打开快速搜索</div> |
| 20 | <div className="settings-item-desc">全局快捷键,在任何位置按下可打开搜索面板</div> |
| 21 | </div> |
| 22 | <ShortcutRecorder |
| 23 | value={config.shortcut_search || "CommandOrControl+Space"} |
| 24 | defaultValue="CommandOrControl+Space" |
| 25 | onRecord={async (shortcut) => { |
| 26 | try { |
| 27 | await invoke("update_global_shortcut", { shortcut }); |
| 28 | update("shortcut_search", shortcut); |
| 29 | } catch (err) { |
| 30 | console.error("Failed to update shortcut:", err); |
| 31 | // Revert UI on failure |
| 32 | loadConfig(); |
| 33 | } |
| 34 | }} |
| 35 | /> |
| 36 | </div> |
| 37 | </div> |
| 38 | </div> |
| 39 | ); |
| 40 | } |
nothing calls this directly
no test coverage detected