forked from 77media/video-flow
更新ScriptRenderer组件,新增from属性以支持不同来源的渲染逻辑。同时,在ScriptTabContent中设置from属性为'tab',优化组件间的数据传递和渲染条件。
This commit is contained in:
parent
c741169b35
commit
8111350709
@ -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>
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user