fix: handling of images fixed

This commit is contained in:
2026-02-10 22:59:05 +01:00
parent 6bbf13dd41
commit 77e117ae06
6 changed files with 61 additions and 10 deletions

View File

@@ -672,11 +672,17 @@ const MediaEditor: React.FC<{ mediaId: string }> = ({ mediaId }) => {
<div className="editor-content media-editor">
<div className="media-preview">
{item.mimeType.startsWith('image/') ? (
<div className="media-preview-placeholder">
<svg width="64" height="64" viewBox="0 0 24 24" fill="currentColor" opacity="0.3">
<path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
</svg>
<span>{item.originalName}</span>
<div className="media-preview-image">
<img
src={`bds-media://${item.id}`}
alt={item.alt || item.originalName}
onError={(e) => {
// Fallback to placeholder if image fails to load
const target = e.target as HTMLImageElement;
target.style.display = 'none';
target.parentElement?.classList.add('has-error');
}}
/>
</div>
) : (
<div className="media-preview-placeholder">