fix(site-builder): bounce stays visible + springier; image/video crop fills (cover) + resize shrinks footprint

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-14 16:04:50 -07:00
parent 2ac62c4e9e
commit 5c44dd545c
6 changed files with 282 additions and 9 deletions
@@ -37,6 +37,18 @@ export const MediaStylePanel: React.FC<StylePanelProps> = ({ selectedId, nodePro
const style = nodeProps.style || {};
// Same crop-fills-by-default + no stale-height-conflict treatment as
// ImageStylePanel (see there for the full rationale): applying a ratio
// defaults objectFit to 'cover' when unset, and clears height so Width +
// ratio + cover is the single source of truth for the box.
const applyAspectRatio = (v: string) => {
setPropStyle('aspectRatio', v);
if (v) {
if (!style.objectFit) setPropStyle('objectFit', 'cover');
setPropStyle('height', '');
}
};
return (
<>
{/* Video source -- upload/browse/paste-URL (paste-URL still handles
@@ -63,9 +75,14 @@ export const MediaStylePanel: React.FC<StylePanelProps> = ({ selectedId, nodePro
value={(style.width as string) || ''}
onChange={(v) => setPropStyle('width', v)}
/>
{/* NOTE: unlike ImageStylePanel, there is no separate Height control
here to gate on aspect-ratio -- VideoBlock's <video>/iframe size
themselves from `width` + `aspectRatio` directly (see
VideoBlock.tsx), not from an outer-wrapper height, so adding one
would reintroduce the exact empty-space bug this fix targets. */}
<AspectRatioControl
value={(style.aspectRatio as string) || ''}
onChange={(v) => setPropStyle('aspectRatio', v)}
onChange={applyAspectRatio}
/>
</>
)}