add a hotkey for menu toggling and a secondary hotkey to search

This commit is contained in:
Rigel Kent 2018-09-02 21:46:43 +02:00 committed by Chocobozzz
parent 61318dd63f
commit 8542dc33e3
1 changed files with 6 additions and 2 deletions

View File

@ -124,10 +124,14 @@ export class AppComponent implements OnInit {
}) })
this.hotkeysService.add([ this.hotkeysService.add([
new Hotkey('/', (event: KeyboardEvent): boolean => { new Hotkey(['/', 's'], (event: KeyboardEvent): boolean => {
document.getElementById('search-video').focus() document.getElementById('search-video').focus()
return false // Prevent bubbling return false
}, undefined, 'Focus the search bar'), }, undefined, 'Focus the search bar'),
new Hotkey('b', (event: KeyboardEvent): boolean => {
this.toggleMenu()
return false
}, undefined, 'Toggle the left menu'),
new Hotkey('g s', (event: KeyboardEvent): boolean => { new Hotkey('g s', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/subscriptions' ]) this.router.navigate([ '/videos/subscriptions' ])
return false return false