From 08a55f871176cba4b64c6cc49e53bd2fe4a056bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E5=BA=94?= Date: Wed, 8 Jul 2026 14:06:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(P0-2):=20=E7=94=BB=E4=B8=AD=E7=94=BB?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8BaddType=E8=87=AA=E5=8A=A8=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B8=BApip=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加useEffect监听currentMode变化 - 当addType不在availableTypes中时自动设为第一个可用类型 - 修复画中画模式下添加片段仍是口播类型的bug --- .../src/pages/editing-planner/components/TimelinePanel.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/src/pages/editing-planner/components/TimelinePanel.tsx b/apps/web/src/pages/editing-planner/components/TimelinePanel.tsx index bc59991a4..867cb6abb 100755 --- a/apps/web/src/pages/editing-planner/components/TimelinePanel.tsx +++ b/apps/web/src/pages/editing-planner/components/TimelinePanel.tsx @@ -66,6 +66,13 @@ const TimelinePanel: React.FC = ({ ? ["pip"] : ["voice", "pip"]; // voice_pip 或默认 + + /* ── 模式切换时自动更新默认添加类型 ── */ + useEffect(() => { + if (!availableTypes.includes(addType)) { + setAddType(availableTypes[0]); + } + }, [currentMode]); /* ── 面板尺寸(宽度固定,高度由 useLayoutEffect 实测) ── */ const PICKER_W = 240; // 面板宽度(与 CSS 一致) const GAP = 6; // 面板与"+"卡片的间距