Skip to content

Write HTML. Render video. Built for agents.

fix(studio): show block preview directly in the player area

Miguel Ángelf51d324ff5a8
diff --git a/packages/studio/src/components/StudioPreviewArea.tsx b/packages/studio/src/components/StudioPreviewArea.tsx
index ff4511de1d..1c14402bc5 100644
--- a/packages/studio/src/components/StudioPreviewArea.tsx
+++ b/packages/studio/src/components/StudioPreviewArea.tsx
@@ -132,7 +132,26 @@ export function StudioPreviewArea({
}}
onIframeRef={handlePreviewIframeRef}
previewOverlay={
- captionEditMode ? (
+ blockPreview ? (
+ <div className="absolute inset-0 z-30 bg-black pointer-events-none">
+ {blockPreview.videoUrl ? (
+ <video
+ src={blockPreview.videoUrl}
+ autoPlay
+ muted
+ loop
+ playsInline
+ className="w-full h-full object-contain"
+ />
+ ) : blockPreview.posterUrl ? (
+ <img
+ src={blockPreview.posterUrl}
+ alt={blockPreview.title}
+ className="w-full h-full object-contain"
+ />
+ ) : null}
+ </div>
+ ) : captionEditMode ? (
<CaptionOverlay iframeRef={previewIframeRef} />
) : STUDIO_INSPECTOR_PANELS_ENABLED ? (
<DomEditOverlay
@@ -177,33 +196,6 @@ export function StudioPreviewArea({
timelineVisible={timelineVisible}
onToggleTimeline={toggleTimelineVisibility}
/>
- {blockPreview && (
- <div className="absolute inset-0 z-40 flex items-center justify-center bg-black/70 pointer-events-none">
- <div className="relative w-[80%] max-w-[900px] rounded-lg overflow-hidden shadow-2xl border border-neutral-700/40">
- <div className="aspect-video bg-neutral-950">
- {blockPreview.videoUrl ? (
- <video
- src={blockPreview.videoUrl}
- autoPlay
- muted
- loop
- playsInline
- className="w-full h-full object-contain"
- />
- ) : blockPreview.posterUrl ? (
- <img
- src={blockPreview.posterUrl}
- alt={blockPreview.title}
- className="w-full h-full object-contain"
- />
- ) : null}
- </div>
- <div className="bg-neutral-900/95 px-3 py-2">
- <div className="text-[12px] font-medium text-neutral-200">{blockPreview.title}</div>
- </div>
- </div>
- </div>
- )}
</div>
);
}