mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 09:01:17 -08:00
1 parent
a4037c7f62
commit
8cef4107b0
2 files changed
+6
-6
No files matched your search
@@ -117,11 +117,11 @@ function RenderMessageContentInternal({
|
||||
{toRender.map(({ url, type }) => {
|
||||
if (type) {
|
||||
return <UrlPreviewCard key={url} url={url} ts={ts} mediaType={type} />;
|
||||
} else if (clientUrlPreview) {
|
||||
return <ClientPreview url={url} />;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (clientUrlPreview) {
|
||||
return <ClientPreview url={url} />;
|
||||
}
|
||||
return null;
|
||||
})}
|
||||
</UrlPreviewHolder>
|
||||
);
|
||||
|
||||
@@ -148,7 +148,7 @@ export const ClientPreview = as<'div', { url: string }>(({ url, ...props }, ref)
|
||||
|
||||
// this component is overly complicated, because it was designed to support more embed types than just youtube
|
||||
// i'm leaving this mess here to support later expansion
|
||||
const isYoutube = youtubeUrl(url);
|
||||
const isYoutube = !!youtubeUrl(url);
|
||||
const videoId = isYoutube ? url.match(/(?:shorts\/|watch\?v=|youtu\.be\/)(.{11})/)?.[1] : null;
|
||||
|
||||
const fetchUrl =
|
||||
@@ -164,7 +164,7 @@ export const ClientPreview = as<'div', { url: string }>(({ url, ...props }, ref)
|
||||
const fetchYoutube = isYoutube && showYoutube;
|
||||
|
||||
if (fetchYoutube) loadEmbed();
|
||||
}, [loadEmbed]);
|
||||
}, [isYoutube, showYoutube, loadEmbed]);
|
||||
|
||||
let previewContent;
|
||||
|
||||
|
||||
Reference in new issue
Block a user