ReplyEditor: supports reply
This commit is contained in:
parent
baf0ed1447
commit
74770649c3
4 changed files with 126 additions and 15 deletions
|
@ -64,7 +64,7 @@ const MediaAttachmentGrid: Component<{
|
|||
>
|
||||
<For each={props.attachments}>
|
||||
{(item, index) => {
|
||||
const [loaded, setLoaded] = createSignal(false)
|
||||
const [loaded, setLoaded] = createSignal(false);
|
||||
const width = item.meta?.small?.width;
|
||||
const height = item.meta?.small?.height;
|
||||
const aspectRatio = item.meta?.small?.aspect;
|
||||
|
@ -74,10 +74,13 @@ const MediaAttachmentGrid: Component<{
|
|||
width && height && height > maxHeight
|
||||
? maxHeight / (aspectRatio ?? 1)
|
||||
: width;
|
||||
const style = () => loaded() ? undefined : {
|
||||
width: realWidth ? `${realWidth}px` : undefined,
|
||||
height: realHeight ? `${realHeight}px` : undefined,
|
||||
};
|
||||
const style = () =>
|
||||
loaded()
|
||||
? undefined
|
||||
: {
|
||||
width: realWidth ? `${realWidth}px` : undefined,
|
||||
height: realHeight ? `${realHeight}px` : undefined,
|
||||
};
|
||||
switch (item.type) {
|
||||
case "image":
|
||||
return (
|
||||
|
@ -100,7 +103,17 @@ const MediaAttachmentGrid: Component<{
|
|||
controls
|
||||
/>
|
||||
);
|
||||
case "gifv":
|
||||
case "gifv": // Later we can handle the preview
|
||||
return (
|
||||
<video
|
||||
src={item.url || undefined}
|
||||
style={style()}
|
||||
onLoadedMetadata={[setLoaded, true]}
|
||||
autoplay={true}
|
||||
controls
|
||||
/>
|
||||
);
|
||||
|
||||
case "audio":
|
||||
case "unknown":
|
||||
return <div></div>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue