From 5e55ec5baab57242dceb2644d2683e2ef522092a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 17:01:52 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0ScriptService=E4=B8=AD?= =?UTF-8?q?=E7=9A=84setter=E5=87=BD=E6=95=B0=EF=BC=8C=E6=96=B0=E5=A2=9Enee?= =?UTF-8?q?dUpdate=E5=8F=82=E6=95=B0=E4=BB=A5=E6=8E=A7=E5=88=B6=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9B=B4=E6=96=B0scriptEditUseCase=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=80=BC=E5=AF=B9=E8=B1=A1=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96useWorkflowData=E5=92=8CEditModal=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E5=A2=9E=E5=BC=BA=E7=8A=B6=E6=80=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=92=8C=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/Interaction/ScriptService.ts | 50 ++--- .../pages/work-flow/use-workflow-data.tsx | 21 +- components/script-renderer/ScriptRenderer.tsx | 37 ++-- components/ui/edit-modal.tsx | 36 +++- components/ui/script-tab-content.tsx | 26 ++- components/ui/shot-tab-content.tsx | 192 +++++++++--------- 6 files changed, 206 insertions(+), 156 deletions(-) diff --git a/app/service/Interaction/ScriptService.ts b/app/service/Interaction/ScriptService.ts index 3e2d780..c04d3e7 100644 --- a/app/service/Interaction/ScriptService.ts +++ b/app/service/Interaction/ScriptService.ts @@ -296,11 +296,11 @@ export const useScriptService = (): UseScriptService => { // 封装的setter函数,同时更新hook状态和scriptEditUseCase中的值对象 const setSynopsisWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(synopsis) : value; console.log('setSynopsisWrapper', newValue); setSynopsis(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("synopsis", newValue); } }, @@ -308,10 +308,10 @@ export const useScriptService = (): UseScriptService => { ); const setCategoriesWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(categories) : value; setCategories(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("categories", newValue); } }, @@ -319,10 +319,10 @@ export const useScriptService = (): UseScriptService => { ); const setProtagonistWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(protagonist) : value; setProtagonist(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("protagonist", newValue); } }, @@ -330,11 +330,11 @@ export const useScriptService = (): UseScriptService => { ); const setIncitingIncidentWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(incitingIncident) : value; setIncitingIncident(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("incitingIncident", newValue); } }, @@ -342,10 +342,10 @@ export const useScriptService = (): UseScriptService => { ); const setProblemWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(problem) : value; setProblem(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("problem", newValue); } }, @@ -353,10 +353,10 @@ export const useScriptService = (): UseScriptService => { ); const setConflictWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(conflict) : value; setConflict(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("conflict", newValue); } }, @@ -364,10 +364,10 @@ export const useScriptService = (): UseScriptService => { ); const setStakesWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(stakes) : value; setStakes(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("stakes", newValue); } }, @@ -375,11 +375,11 @@ export const useScriptService = (): UseScriptService => { ); const setCharacterArcWrapper = useCallback( - (value: SetStateAction) => { + (value: SetStateAction, needUpdate: boolean=true) => { const newValue = typeof value === "function" ? value(characterArc) : value; setCharacterArc(newValue); - if (scriptEditUseCase) { + if (scriptEditUseCase && needUpdate) { scriptEditUseCase.updateStoryField("characterArc", newValue); } }, @@ -387,40 +387,40 @@ export const useScriptService = (): UseScriptService => { ); const setAnyAttributeWrapper = useCallback( - (type: string, value: string,callback: (old: string) => void=() => {}) => { + (type: string, value: string,needUpdate: boolean=true,callback: (old: string) => void=() => {}) => { console.log('setAnyAttributeWrapper', type); if (type === 'synopsis') { setFieldOld(synopsis) scriptEditUseCase.replaceScript(fieldOld,value ) - setSynopsisWrapper(value); + setSynopsisWrapper(value, needUpdate); } else if (type === 'categories') { setFieldOld(categories.join(',')) scriptEditUseCase.replaceScript(fieldOld,value) - setCategoriesWrapper(value.split(',') || []); + setCategoriesWrapper(value.split(',') || [], needUpdate); } else if (type === 'protagonist') { setFieldOld(protagonist) scriptEditUseCase.replaceScript(fieldOld,value) - setProtagonistWrapper(value); + setProtagonistWrapper(value, needUpdate); } else if (type === 'incitingIncident') { setFieldOld(incitingIncident) scriptEditUseCase.replaceScript(fieldOld,value) - setIncitingIncidentWrapper(value); + setIncitingIncidentWrapper(value, needUpdate); } else if (type === 'problem') { setFieldOld(problem) scriptEditUseCase.replaceScript(fieldOld,value) - setProblemWrapper(value); + setProblemWrapper(value, needUpdate); } else if (type === 'conflict') { setFieldOld(conflict) scriptEditUseCase.replaceScript(fieldOld,value) - setConflictWrapper(value); + setConflictWrapper(value, needUpdate); } else if (type === 'stakes') { setFieldOld(stakes) scriptEditUseCase.replaceScript(fieldOld,value) - setStakesWrapper(value); + setStakesWrapper(value, needUpdate); } else if (type === 'characterArc') { setFieldOld(characterArc) scriptEditUseCase.replaceScript(fieldOld,value) - setCharacterArcWrapper(value); + setCharacterArcWrapper(value, needUpdate); } callback(fieldOld) }, diff --git a/components/pages/work-flow/use-workflow-data.tsx b/components/pages/work-flow/use-workflow-data.tsx index 3a22ae1..646c821 100644 --- a/components/pages/work-flow/use-workflow-data.tsx +++ b/components/pages/work-flow/use-workflow-data.tsx @@ -80,7 +80,7 @@ export function useWorkflowData() { const [dataLoadError, setDataLoadError] = useState(null); const [needStreamData, setNeedStreamData] = useState(false); const [isPauseWorkFlow, setIsPauseWorkFlow] = useState(false); - const [mode, setMode] = useState<'automatic' | 'manual'>('automatic'); + const [mode, setMode] = useState<'automatic' | 'manual' | 'auto'>('automatic'); const taskData: any = { sketch: { data: [], total_count: -1 }, @@ -102,13 +102,15 @@ export function useWorkflowData() { } = useScriptService(); // 初始化剧本 useEffect(() => { - console.log('开始初始化剧本', originalText,episodeId); - // TODO 为什么一开始没项目id - originalText && initializeFromProject(episodeId, originalText).then(() => { - console.log('应用剧本'); - // 自动模式下 应用剧本;手动模式 需要点击 下一步 触发 - mode.includes('auto') && applyScript(); - }); + if (currentStep !== '0') { + console.log('开始初始化剧本', originalText,episodeId); + // TODO 为什么一开始没项目id + originalText && initializeFromProject(episodeId, originalText).then(() => { + console.log('应用剧本'); + // 自动模式下 应用剧本;手动模式 需要点击 下一步 触发 + mode.includes('auto') && applyScript(); + }); + } }, [originalText]); // 监听剧本加载完毕 useEffect(() => { @@ -176,7 +178,7 @@ export function useWorkflowData() { // 替换原有的 setSketchCount 和 setVideoCount 调用 useEffect(() => { console.log('sketchCount 已更新:', sketchCount); - setCurrentSketchIndex(sketchCount - 1); + currentStep !== '3' && setCurrentSketchIndex(sketchCount - 1); }, [sketchCount]); useEffect(() => { @@ -446,6 +448,7 @@ export function useWorkflowData() { if (status === 'COMPLETED') { loadingText = LOADING_TEXT_MAP.complete; + taskData.status = '6'; } // 如果有已完成的数据,同步到状态 diff --git a/components/script-renderer/ScriptRenderer.tsx b/components/script-renderer/ScriptRenderer.tsx index 8890f90..161e8c0 100644 --- a/components/script-renderer/ScriptRenderer.tsx +++ b/components/script-renderer/ScriptRenderer.tsx @@ -15,9 +15,10 @@ interface ScriptRendererProps { applyScript: any; mode: string; from: string; + setIsUpdate?: (isUpdate: boolean) => void; } -export const ScriptRenderer: React.FC = ({ data, setIsPauseWorkFlow, setAnyAttribute, isPauseWorkFlow, applyScript, mode, from }) => { +export const ScriptRenderer: React.FC = ({ data, setIsPauseWorkFlow, setAnyAttribute, isPauseWorkFlow, applyScript, mode, from, setIsUpdate }) => { const [activeBlockId, setActiveBlockId] = useState(null); const [hoveredBlockId, setHoveredBlockId] = useState(null); const contentRefs = useRef<{ [key: string]: HTMLDivElement | null }>({}); @@ -114,14 +115,17 @@ export const ScriptRenderer: React.FC = ({ data, setIsPause if (contentEditableRef.current) { const text = contentEditableRef.current.innerText; console.log('contentEditableRef---text', text); - if (from !== 'tab') { - setAnyAttribute(block.id, text,(old: string)=>{ - if(old!==text){ - mode.includes('auto') && applyScript(); - setIsPauseWorkFlow(false); - } - }); + console.log('contentEditableRef---block', block.id, block); + if (block.content[0].text !== text) { + setIsUpdate(true); } + setAnyAttribute(block.id, text,from !== 'tab',(old: string)=>{ + if(old!==text){ + console.log('contentEditableRef---change?') + mode.includes('auto') && applyScript(); + setIsPauseWorkFlow(false); + } + }); } }; @@ -136,15 +140,14 @@ export const ScriptRenderer: React.FC = ({ data, setIsPause return; } setAddThemeTag(value); - if (from !== 'tab') { - setIsPauseWorkFlow(true); - setAnyAttribute('categories', value.join(','),(old: string)=>{ - if(old!==value.join(',')){ - mode.includes('auto') && applyScript(); - setIsPauseWorkFlow(false); - } - }); - } + setIsUpdate(true); + from !== 'tab' && setIsPauseWorkFlow(true); + setAnyAttribute('categories', value.join(','),from !== 'tab',(old: string)=>{ + if(old!==value.join(',')){ + mode.includes('auto') && applyScript(); + setIsPauseWorkFlow(false); + } + }); }; const handleEditBlock = (block: ScriptBlock) => { diff --git a/components/ui/edit-modal.tsx b/components/ui/edit-modal.tsx index 964a28f..75193f8 100644 --- a/components/ui/edit-modal.tsx +++ b/components/ui/edit-modal.tsx @@ -1,6 +1,6 @@ 'use client'; -import React, { useState, useEffect, SetStateAction } from 'react'; +import React, { useState, useEffect, SetStateAction, useRef } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { X, Image, Users, Video, Music, Settings, FileText, Undo2, TriangleAlert } from 'lucide-react'; import { cn } from '@/public/lib/utils'; @@ -63,6 +63,10 @@ export function EditModal({ const [isRemindFallbackOpen, setIsRemindFallbackOpen] = useState(false); const [isRemindResetOpen, setIsRemindResetOpen] = useState(false); const [resetKey, setResetKey] = useState(0); + const [remindFallbackText, setRemindFallbackText] = useState('The task will be regenerated and edited. Do you want to continue?'); + const scriptTabContentRef = useRef(null); + // 添加一个状态来标记是否是从切换tab触发的提醒 +const [pendingSwitchTabId, setPendingSwitchTabId] = useState(null); useEffect(() => { setCurrentIndex(currentSketchIndex); @@ -91,8 +95,27 @@ export function EditModal({ } } + const checkUpdate = (tabId: string) => { + if (tabId === '0') { + const scriptTabContent = scriptTabContentRef.current; + if (scriptTabContent) { + return scriptTabContent.checkUpdate(); + } + } + return false; + } + const handleChangeTab = (tabId: string, disabled: boolean) => { if (disabled) return; + // 切换前 检查是否更新 + const isUpdate = checkUpdate(activeTab); + console.log('contentEditableRef---isUpdate', isUpdate); + if (isUpdate) { + setPendingSwitchTabId(tabId); // 记录要切换到的目标tab + setRemindFallbackText('You must click Apply button to save the current changes.'); + setIsRemindFallbackOpen(true); + return; + } setActiveTab(tabId); setCurrentIndex(0); } @@ -112,6 +135,12 @@ export function EditModal({ } } const handleCloseRemindFallbackPanel = () => { + if (pendingSwitchTabId) { + // 如果是从切换tab触发的提醒,关闭后执行tab切换 + setActiveTab(pendingSwitchTabId); + setCurrentIndex(0); + setPendingSwitchTabId(null); // 清除记录 + } setIsRemindFallbackOpen(false); } @@ -132,6 +161,7 @@ export function EditModal({ case '0': return (
-

The task will be regenerated and edited. Do you want to continue?

+

{remindFallbackText}

@@ -321,7 +351,7 @@ export function EditModal({ className="px-4 py-2 bg-blue-600 hover:bg-blue-700 rounded-md transition-colors duration-200 flex items-center gap-2" > - Continue + Apply
); -}; +}); diff --git a/components/ui/shot-tab-content.tsx b/components/ui/shot-tab-content.tsx index 480466a..6fad1db 100644 --- a/components/ui/shot-tab-content.tsx +++ b/components/ui/shot-tab-content.tsx @@ -293,105 +293,107 @@ export function ShotTabContent({ {/* 下部分 */} - - {/* 视频预览和操作 */} -
- {/* 选中的视频预览 */} - <> - {shotData[selectedIndex]?.status === 0 && ( -
- - Loading... -
- )} - {shotData[selectedIndex]?.status === 1 && ( - - - - {/* 人物替换按钮 */} - handleScan()} - className={`p-2 backdrop-blur-sm transition-colors z-10 rounded-full - ${scanState === 'detected' - ? 'bg-cyan-500/50 hover:bg-cyan-500/70 text-white' - : 'bg-black/50 hover:bg-black/70 text-white' - }`} - whileHover={{ scale: 1.05 }} - whileTap={{ scale: 0.95 }} - > - {scanState === 'scanning' ? ( - - ) : scanState === 'detected' ? ( - - ) : ( - - )} - + {shotData[selectedIndex] && ( + + {/* 视频预览和操作 */} +
+ {/* 选中的视频预览 */} + <> + {shotData[selectedIndex]?.status === 0 && ( +
+ + Loading... +
+ )} + {shotData[selectedIndex]?.status === 1 && ( + + + + {/* 人物替换按钮 */} + handleScan()} + className={`p-2 backdrop-blur-sm transition-colors z-10 rounded-full + ${scanState === 'detected' + ? 'bg-cyan-500/50 hover:bg-cyan-500/70 text-white' + : 'bg-black/50 hover:bg-black/70 text-white' + }`} + whileHover={{ scale: 1.05 }} + whileTap={{ scale: 0.95 }} + > + {scanState === 'scanning' ? ( + + ) : scanState === 'detected' ? ( + + ) : ( + + )} + + - - )} - {shotData[selectedIndex]?.status === 2 && ( -
- - 任务失败,点击重新生成 -
- )} - -
- - {/* 基础配置 */} -
- - - {/* 重新生成按钮、新增分镜按钮 */} -
- handleAddShot()} - className="flex items-center justify-center gap-2 px-4 py-3 bg-pink-500/10 hover:bg-pink-500/20 - text-pink-500 rounded-lg transition-colors" - whileHover={{ scale: 1.02 }} - whileTap={{ scale: 0.98 }} - > - - Add Shot - - handleRegenerate()} - className="flex items-center justify-center gap-2 px-4 py-3 bg-blue-500/10 hover:bg-blue-500/20 - text-blue-500 rounded-lg transition-colors" - whileHover={{ scale: 1.02 }} - whileTap={{ scale: 0.98 }} - > - - Regenerate - + )} + {shotData[selectedIndex]?.status === 2 && ( +
+ + 任务失败,点击重新生成 +
+ )} + +
+ + {/* 基础配置 */} +
+ + + {/* 重新生成按钮、新增分镜按钮 */} +
+ handleAddShot()} + className="flex items-center justify-center gap-2 px-4 py-3 bg-pink-500/10 hover:bg-pink-500/20 + text-pink-500 rounded-lg transition-colors" + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + > + + Add Shot + + handleRegenerate()} + className="flex items-center justify-center gap-2 px-4 py-3 bg-blue-500/10 hover:bg-blue-500/20 + text-blue-500 rounded-lg transition-colors" + whileHover={{ scale: 1.02 }} + whileTap={{ scale: 0.98 }} + > + + Regenerate + +
-
-
+
+ )} Date: Wed, 13 Aug 2025 17:45:34 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84=E4=BB=A5?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E4=B8=AA=E8=A7=92=E8=89=B2=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E5=B9=B6=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=87=BD=E6=95=B0=E4=BB=A5=E9=80=82=E5=BA=94?= =?UTF-8?q?=E6=96=B0=E7=BB=93=E6=9E=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/DTO/movieEdit.ts | 20 ++++++++++++-------- api/video_flow.ts | 2 +- app/service/usecase/RoleEditUseCase.ts | 12 ++++++------ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/api/DTO/movieEdit.ts b/api/DTO/movieEdit.ts index 383746f..94abf18 100644 --- a/api/DTO/movieEdit.ts +++ b/api/DTO/movieEdit.ts @@ -602,14 +602,18 @@ export interface RoleRecognitionResponse { characters_used: CharacterUsed[]; } export interface RoleResponse { - /** 角色描述 */ - character_description: string; - /** 角色名称 */ - character_name: string; - /** 高亮关键词 */ - highlights: string[]; - /** 角色图片地址 */ - image_path: string; + characters: { + /** 角色描述 */ + character_description: string; + /** 角色名称 */ + character_name: string; + /** 高亮关键词 */ + highlights: string[]; + /** 角色图片地址 */ + image_path: string; + /** 角色图片地址 */ + image_url: string; + }[]; /**缓存 */ character_draft: string; } diff --git a/api/video_flow.ts b/api/video_flow.ts index f8752d8..1a43125 100644 --- a/api/video_flow.ts +++ b/api/video_flow.ts @@ -918,7 +918,7 @@ export const getCharacterListByProjectWithHighlight = async (request: { project_id: string; /** 每个角色最多提取的高亮关键词数量 */ max_keywords?: number; -}): Promise> => { +}): Promise> => { return post("/character/list_by_project_with_highlight", request); }; diff --git a/app/service/usecase/RoleEditUseCase.ts b/app/service/usecase/RoleEditUseCase.ts index 639211f..4402343 100644 --- a/app/service/usecase/RoleEditUseCase.ts +++ b/app/service/usecase/RoleEditUseCase.ts @@ -86,16 +86,16 @@ export class RoleEditUseCase { * @returns {RoleEntity[]} 角色实体数组 * @throws {Error} 如果数据格式不正确则抛出异常 */ - parseProjectRoleList(projectRoleData: RoleResponse[]): RoleEntity[] { + parseProjectRoleList(projectRoleData: RoleResponse): RoleEntity[] { if (!Array.isArray(projectRoleData)) { throw new Error('项目角色数据格式错误'); } - return projectRoleData.map((char, index) => { - if(char.character_draft){ - const roleEntity: RoleEntity = JSON.parse(char.character_draft); - return roleEntity; - } + if(projectRoleData.character_draft){ + const roleEntity: RoleEntity[] = JSON.parse(projectRoleData.character_draft); + return roleEntity; + } + return projectRoleData.characters.map((char, index) => { /** 角色实体对象 */ const roleEntity: RoleEntity = { id: `role_${index + 1}`, From 863858bcb6d17131c017961db73babd2d82f4c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 18:09:37 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0MediaViewer=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E4=BF=AE=E6=94=B9handleEditClick=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=BB=A5=E6=94=AF=E6=8C=81=E4=BB=8E'final'=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=9A=82=E5=81=9C=E8=A7=86=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E5=9C=A8=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BA=8B=E4=BB=B6=E4=B8=AD=E4=BC=A0=E9=80=92?= =?UTF-8?q?=E8=AF=A5=E5=8F=82=E6=95=B0=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BA=A4=E4=BA=92=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/pages/work-flow/media-viewer.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/pages/work-flow/media-viewer.tsx b/components/pages/work-flow/media-viewer.tsx index e94e7a4..dd7a6d1 100644 --- a/components/pages/work-flow/media-viewer.tsx +++ b/components/pages/work-flow/media-viewer.tsx @@ -147,7 +147,11 @@ export function MediaViewer({ }; // 包装编辑按钮点击事件 - const handleEditClick = (tab: string) => { + const handleEditClick = (tab: string, from?: string) => { + if (from === 'final') { + // 暂停视频播放 + finalVideoRef.current?.pause(); + } // TODO 点击没有任何事件效果,页面没变化 setUserHasInteracted(true); onEditModalOpen(tab); @@ -348,7 +352,7 @@ export function MediaViewer({ handleEditClick('4')} + onClick={() => handleEditClick('4', 'final')} />
)} From 1b4cb95caa8b5fad3348f90257bee51481b406b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 18:12:41 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=87=BD=E6=95=B0=E4=B8=AD=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=A0=BC=E5=BC=8F=E6=A3=80=E6=9F=A5=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/usecase/RoleEditUseCase.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/service/usecase/RoleEditUseCase.ts b/app/service/usecase/RoleEditUseCase.ts index 4402343..ffa55bb 100644 --- a/app/service/usecase/RoleEditUseCase.ts +++ b/app/service/usecase/RoleEditUseCase.ts @@ -87,9 +87,9 @@ export class RoleEditUseCase { * @throws {Error} 如果数据格式不正确则抛出异常 */ parseProjectRoleList(projectRoleData: RoleResponse): RoleEntity[] { - if (!Array.isArray(projectRoleData)) { - throw new Error('项目角色数据格式错误'); - } + // if (!Array.isArray(projectRoleData)) { + // throw new Error('项目角色数据格式错误'); + // } if(projectRoleData.character_draft){ const roleEntity: RoleEntity[] = JSON.parse(projectRoleData.character_draft); From 33e3ef3a1ef3079b210489dc81e91e4c1868819c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 18:20:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=9C=A8=E5=8F=97?= =?UTF-8?q?=E6=8E=A7=E7=BB=84=E4=BB=B6=E4=B8=AD=E7=9B=B4=E6=8E=A5=E4=BD=BF?= =?UTF-8?q?=E7=94=A8contentEditable=20=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/main-editor/HighlightText.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/ui/main-editor/HighlightText.tsx b/components/ui/main-editor/HighlightText.tsx index cfdb317..4097535 100644 --- a/components/ui/main-editor/HighlightText.tsx +++ b/components/ui/main-editor/HighlightText.tsx @@ -17,13 +17,25 @@ interface HighlightTextOptions { } export function HighlightText(props: ReactNodeViewProps) { - const { text, color } = props.node.attrs as HighlightTextAttributes + const { text: initialText, color } = props.node.attrs as HighlightTextAttributes + const [text, setText] = useState(initialText) + + const handleInput = (e: React.FormEvent) => { + const newText = e.currentTarget.textContent || '' + setText(newText) + // 通知Tiptap更新内容 + props.updateAttributes({ + text: newText + }) + } return ( {text}