mirror of
https://github.com/Xinrea/bili-shadowreplay.git
synced 2025-11-25 04:22:24 +08:00
fix: shortcut key conflicts with input (#212)
* fix: shortcut key conflicts with input * Update src/lib/components/VideoPreview.svelte Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -809,8 +809,16 @@
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (!show || !isVideoLoaded) return;
|
||||
|
||||
// 如果在输入框中,不处理某些快捷键
|
||||
const isInInput = (event.target as HTMLElement)?.tagName === "INPUT";
|
||||
const target = event.target as HTMLElement | null;
|
||||
const tagName = target?.tagName;
|
||||
|
||||
// 如果当前焦点位于可编辑元素内,则跳过快捷键处理
|
||||
const isInInput =
|
||||
(!!tagName && ["INPUT", "TEXTAREA", "SELECT"].includes(tagName)) ||
|
||||
!!target?.isContentEditable ||
|
||||
!!target?.closest(
|
||||
"input, textarea, select, [contenteditable='true'], [data-hotkey-block]"
|
||||
);
|
||||
|
||||
switch (event.key) {
|
||||
case "【":
|
||||
|
||||
Reference in New Issue
Block a user