MediaAttachmentGrid: fix the element not updated
All checks were successful
/ depoly (push) Successful in 1m19s

This problem causes "not supported codec"
This commit is contained in:
thislight 2024-11-07 23:57:11 +08:00
parent f965bb4002
commit acde7609ba
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E

View file

@ -152,6 +152,7 @@ const MediaAttachmentGrid: Component<{
return ( return (
<img <img
data-sort={index} data-sort={index}
data-media-type={item().type}
src={item().previewUrl} src={item().previewUrl}
width={item().meta?.small?.width} width={item().meta?.small?.width}
height={item().meta?.small?.height} height={item().meta?.small?.height}
@ -165,6 +166,7 @@ const MediaAttachmentGrid: Component<{
return ( return (
<video <video
data-sort={index} data-sort={index}
data-media-type={item().type}
src={item().url || undefined} src={item().url || undefined}
autoplay={settings().autoPlayVideos} autoplay={settings().autoPlayVideos}
playsinline={settings().autoPlayVideos ? true : undefined} playsinline={settings().autoPlayVideos ? true : undefined}
@ -178,6 +180,8 @@ const MediaAttachmentGrid: Component<{
case "gifv": case "gifv":
return ( return (
<video <video
data-sort={index}
data-media-type={item().type}
src={item().url || undefined} src={item().url || undefined}
autoplay={settings().autoPlayGIFs} autoplay={settings().autoPlayGIFs}
controls controls
@ -191,6 +195,14 @@ const MediaAttachmentGrid: Component<{
); );
case "audio": case "audio":
return (
<audio
data-sort={index}
data-media-type={item().type}
src={item().url || undefined}
controls
></audio>
);
case "unknown": case "unknown":
return <div></div>; return <div></div>;
} }