From c17874bf1e07e8cce93d6287bb59f2a8468e8669 Mon Sep 17 00:00:00 2001 From: Tachibana Shin Date: Fri, 8 Mar 2024 20:04:06 +0000 Subject: [PATCH] fix: confused player shortcuts with `ctrlKey` and `altKey` --- src/components/BrtPlayer.vue | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/BrtPlayer.vue b/src/components/BrtPlayer.vue index b6cf98b7..6e939973 100644 --- a/src/components/BrtPlayer.vue +++ b/src/components/BrtPlayer.vue @@ -227,10 +227,10 @@ artCurrentTimeHoving <= intro.end ? '\n ' + $t('mo-dau') : outro && - artCurrentTimeHoving >= outro.start && - artCurrentTimeHoving <= outro.end - ? '\n ' + $t('ket-thuc') - : '') + artCurrentTimeHoving >= outro.start && + artCurrentTimeHoving <= outro.end + ? '\n ' + $t('ket-thuc') + : '') " :style="{ width: `${(artCurrentTimeHoving / artDuration) * 100}%` @@ -2535,9 +2535,16 @@ function skipOpening() { ) } useEventListener(window, "keydown", (event: KeyboardEvent) => { + if ( + document.activeElement?.tagName === "INPUT" || + document.activeElement?.tagName === "TEXTAREA" + ) + return + switch (event.code) { case "Space": case "KeyK": { + if (event.ctrlKey || event.shiftKey) break if (!checkContentEditable(event.target as Element | null)) event.preventDefault() const playing = artPlaying.value @@ -2547,39 +2554,50 @@ useEventListener(window, "keydown", (event: KeyboardEvent) => { break } case "KeyF": + if (event.ctrlKey || event.shiftKey) break void toggleArtFullscreen() break case "ArrowLeft": + if (event.ctrlKey || event.shiftKey) break skipBack() break case "ArrowRight": + if (event.ctrlKey || event.shiftKey) break skipForward() break case "ArrowUp": + if (event.ctrlKey || event.shiftKey) break if (artFullscreen.value) upVolume() break case "ArrowDown": + if (event.ctrlKey || event.shiftKey) break if (artFullscreen.value) downVolume() break case "KeyM": + if (event.ctrlKey || event.shiftKey) break toggleMuted() break case "KeyN": + if (event.ctrlKey) break if (event.shiftKey) emitNextChap(true) break case "KeyP": + if (event.ctrlKey) break if (event.shiftKey) emitPrevChap(true) break case "KeyJ": + if (event.ctrlKey || event.shiftKey) break skipOpening() break case "KeyT": + if (event.ctrlKey || event.shiftKey) break settingsStore.ui.modeMovie = !settingsStore.ui.modeMovie break case "Enter": + if (event.ctrlKey || event.shiftKey) break if (skiping.value) skipOpEnd() break