shortcut for new chat

This commit is contained in:
Arjun 2026-05-18 23:22:54 +05:30
parent 215e0aedd6
commit 48eb9214c8

View file

@ -3808,6 +3808,18 @@ function App() {
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).
useEffect(() => {
const handleHistoryKeyDown = (e: KeyboardEvent) => {