Don't conflict with alt + num web browser hotkey

pull/5378/head
Chocobozzz 2022-10-25 16:26:05 +02:00
parent 1c048f04a5
commit ce3121efeb
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 5 additions and 1 deletions

View File

@ -160,7 +160,7 @@ class PeerTubeHotkeysPlugin extends Plugin {
// 0-9 key handlers
for (let i = 0; i < 10; i++) {
handlers.push({
accept: e => e.key === i + '' && !e.ctrlKey, // If using ctrl key, it's a web browser hotkey
accept: e => this.isNakedOrShift(e, i + ''),
cb: e => {
e.preventDefault()
@ -190,6 +190,10 @@ class PeerTubeHotkeysPlugin extends Plugin {
private isNaked (event: KeyboardEvent, key: string) {
return (!event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey && event.key === key)
}
private isNakedOrShift (event: KeyboardEvent, key: string) {
return (!event.ctrlKey && !event.altKey && !event.metaKey && event.key === key)
}
}
videojs.registerPlugin('peerTubeHotkeysPlugin', PeerTubeHotkeysPlugin)