From ce3121efebfd4e97b2fddbf2f3f79ddcfcb94004 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 Oct 2022 16:26:05 +0200 Subject: Don't conflict with alt + num web browser hotkey --- client/src/assets/player/shared/hotkeys/peertube-hotkeys-plugin.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/src/assets/player/shared') 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 { // 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) -- cgit v1.2.3