fix(builder): Image block placeholder no longer overridden by explicit src=""
BlocksPanel dropped a new Image block with an explicit `src=""` prop, which overrides ImageBlock's `src = PLACEHOLDER_SRC` default parameter (defaults only apply when a prop is undefined, not when it's an empty string). Craft then persisted `src:''`, and the canvas rendered a broken-image icon instead of the placeholder. - ImageBlock render now falls back to PLACEHOLDER_SRC whenever src is falsy (belt-and-braces: also recovers any legacy saved src:'' state). - BlocksPanel no longer passes src="" when dropping a new Image block, so the craft default applies. - ImageStylePanel now restores the placeholder (instead of blanking to '') when the URL field is cleared. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -123,7 +123,7 @@ const categories: CategoryDef[] = [
|
||||
label: 'Media',
|
||||
blocks: [
|
||||
{ id: 'image', label: 'Image', icon: 'fa-image',
|
||||
component: <ImageBlock src="" alt="Image" style={{ maxWidth: '100%', height: 'auto', display: 'block', borderRadius: '8px' }} /> },
|
||||
component: <ImageBlock alt="Image" style={{ maxWidth: '100%', height: 'auto', display: 'block', borderRadius: '8px' }} /> },
|
||||
{ id: 'video', label: 'Video', icon: 'fa-play-circle',
|
||||
component: <VideoBlock videoUrl="" isBackground={false} /> },
|
||||
{ id: 'map-embed', label: 'Map', icon: 'fa-map-marker',
|
||||
|
||||
Reference in New Issue
Block a user