diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-25 16:26:05 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-25 16:26:05 +0200 |
commit | ce3121efebfd4e97b2fddbf2f3f79ddcfcb94004 (patch) | |
tree | bd2c83c67ffade44a783c1300ad1c887d31674d8 /client/src/assets/player | |
parent | 1c048f04a5a37fcf870804157216a271ac709e9d (diff) | |
download | PeerTube-ce3121efebfd4e97b2fddbf2f3f79ddcfcb94004.tar.gz PeerTube-ce3121efebfd4e97b2fddbf2f3f79ddcfcb94004.tar.zst PeerTube-ce3121efebfd4e97b2fddbf2f3f79ddcfcb94004.zip |
Don't conflict with alt + num web browser hotkey
Diffstat (limited to 'client/src/assets/player')
-rw-r--r-- | client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts b/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts index 8255245b5..ec1e1038b 100644 --- a/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts +++ b/client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts | |||
@@ -160,7 +160,7 @@ class PeerTubeHotkeysPlugin extends Plugin { | |||
160 | // 0-9 key handlers | 160 | // 0-9 key handlers |
161 | for (let i = 0; i < 10; i++) { | 161 | for (let i = 0; i < 10; i++) { |
162 | handlers.push({ | 162 | handlers.push({ |
163 | accept: e => e.key === i + '' && !e.ctrlKey, // If using ctrl key, it's a web browser hotkey | 163 | accept: e => this.isNakedOrShift(e, i + ''), |
164 | cb: e => { | 164 | cb: e => { |
165 | e.preventDefault() | 165 | e.preventDefault() |
166 | 166 | ||
@@ -190,6 +190,10 @@ class PeerTubeHotkeysPlugin extends Plugin { | |||
190 | private isNaked (event: KeyboardEvent, key: string) { | 190 | private isNaked (event: KeyboardEvent, key: string) { |
191 | return (!event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey && event.key === key) | 191 | return (!event.ctrlKey && !event.altKey && !event.metaKey && !event.shiftKey && event.key === key) |
192 | } | 192 | } |
193 | |||
194 | private isNakedOrShift (event: KeyboardEvent, key: string) { | ||
195 | return (!event.ctrlKey && !event.altKey && !event.metaKey && event.key === key) | ||
196 | } | ||
193 | } | 197 | } |
194 | 198 | ||
195 | videojs.registerPlugin('peerTubeHotkeysPlugin', PeerTubeHotkeysPlugin) | 199 | videojs.registerPlugin('peerTubeHotkeysPlugin', PeerTubeHotkeysPlugin) |