mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-07-12 21:02:17 +02:00
shortcut for new chat
This commit is contained in:
parent
215e0aedd6
commit
48eb9214c8
1 changed files with 12 additions and 0 deletions
|
|
@ -3808,6 +3808,18 @@ function App() {
|
||||||
return () => document.removeEventListener('keydown', handleKeyDown)
|
return () => document.removeEventListener('keydown', handleKeyDown)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
// Keyboard shortcut: Cmd+N / Ctrl+N opens a new chat tab.
|
||||||
|
useEffect(() => {
|
||||||
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if ((e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey && e.key.toLowerCase() === 'n') {
|
||||||
|
e.preventDefault()
|
||||||
|
handleNewChatTab()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener('keydown', handleKeyDown)
|
||||||
|
return () => document.removeEventListener('keydown', handleKeyDown)
|
||||||
|
}, [handleNewChatTab])
|
||||||
|
|
||||||
// Route undo/redo to the active markdown tab only (prevents cross-tab browser undo behavior).
|
// Route undo/redo to the active markdown tab only (prevents cross-tab browser undo behavior).
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleHistoryKeyDown = (e: KeyboardEvent) => {
|
const handleHistoryKeyDown = (e: KeyboardEvent) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue