更新ScriptRenderer组件,新增from属性以支持不同来源的渲染逻辑。同时,在ScriptTabContent中设置from属性为'tab',优化组件间的数据传递和渲染条件。

This commit is contained in:
北枳 2025-08-12 19:18:04 +08:00
parent c741169b35
commit 8111350709
2 changed files with 4 additions and 2 deletions

View File

@ -14,9 +14,10 @@ interface ScriptRendererProps {
isPauseWorkFlow: boolean; isPauseWorkFlow: boolean;
applyScript: any; applyScript: any;
mode: string; mode: string;
from: string;
} }
export const ScriptRenderer: React.FC<ScriptRendererProps> = ({ data, setIsPauseWorkFlow, setAnyAttribute, isPauseWorkFlow, applyScript, mode }) => { export const ScriptRenderer: React.FC<ScriptRendererProps> = ({ data, setIsPauseWorkFlow, setAnyAttribute, isPauseWorkFlow, applyScript, mode, from }) => {
const [activeBlockId, setActiveBlockId] = useState<string | null>(null); const [activeBlockId, setActiveBlockId] = useState<string | null>(null);
const [hoveredBlockId, setHoveredBlockId] = useState<string | null>(null); const [hoveredBlockId, setHoveredBlockId] = useState<string | null>(null);
const contentRefs = useRef<{ [key: string]: HTMLDivElement | null }>({}); const contentRefs = useRef<{ [key: string]: HTMLDivElement | null }>({});
@ -72,7 +73,7 @@ export const ScriptRenderer: React.FC<ScriptRendererProps> = ({ data, setIsPause
default: default:
return <p className="mb-2"> return <p className="mb-2">
{ {
isInit ? ( (isInit && from !== 'tab') ? (
<TypewriterText text={content.text || ''} stableId={content.type} /> <TypewriterText text={content.text || ''} stableId={content.type} />
) : ( ) : (
<span>{content.text}</span> <span>{content.text}</span>

View File

@ -43,6 +43,7 @@ export function ScriptTabContent({
isPauseWorkFlow={isPauseWorkFlow} isPauseWorkFlow={isPauseWorkFlow}
applyScript={applyScript} applyScript={applyScript}
mode='manual' mode='manual'
from='tab'
/> />
</motion.div> </motion.div>
</div> </div>