修复 聚焦 冲突问题

This commit is contained in:
北枳 2025-08-16 18:22:25 +08:00
parent 1f049a97d7
commit 540737210d
2 changed files with 5 additions and 2 deletions

View File

@ -178,6 +178,7 @@ const WorkFlow = React.memo(function WorkFlow() {
<div className="imageGrid-ymZV9z hide-scrollbar"> <div className="imageGrid-ymZV9z hide-scrollbar">
<ErrorBoundary> <ErrorBoundary>
<ThumbnailGrid <ThumbnailGrid
isEditModalOpen={isEditModalOpen}
taskObject={taskObject} taskObject={taskObject}
isLoading={isLoading} isLoading={isLoading}
currentSketchIndex={currentSketchIndex} currentSketchIndex={currentSketchIndex}

View File

@ -8,6 +8,7 @@ import { Loader2, X } from 'lucide-react';
import { TaskObject } from '@/api/DTO/movieEdit'; import { TaskObject } from '@/api/DTO/movieEdit';
interface ThumbnailGridProps { interface ThumbnailGridProps {
isEditModalOpen: boolean;
taskObject: TaskObject; taskObject: TaskObject;
isLoading: boolean; isLoading: boolean;
currentSketchIndex: number; currentSketchIndex: number;
@ -21,6 +22,7 @@ interface ThumbnailGridProps {
} }
export function ThumbnailGrid({ export function ThumbnailGrid({
isEditModalOpen,
taskObject, taskObject,
isLoading, isLoading,
currentSketchIndex, currentSketchIndex,
@ -122,7 +124,7 @@ export function ThumbnailGrid({
// 监听键盘事件 // 监听键盘事件
useEffect(() => { useEffect(() => {
// 组件挂载时自动聚焦 // 组件挂载时自动聚焦
if (thumbnailsRef.current) { if (thumbnailsRef.current && !isEditModalOpen) {
thumbnailsRef.current.focus(); thumbnailsRef.current.focus();
} }
@ -132,7 +134,7 @@ export function ThumbnailGrid({
// 确保在数据变化时保持焦点 // 确保在数据变化时保持焦点
useEffect(() => { useEffect(() => {
if (thumbnailsRef.current && !isFocused) { if (thumbnailsRef.current && !isFocused && !isEditModalOpen) {
thumbnailsRef.current.focus(); thumbnailsRef.current.focus();
} }
}, [taskObject.currentStage, isFocused]); }, [taskObject.currentStage, isFocused]);