small fixed

This commit is contained in:
Ren Amamiya
2023-10-01 15:00:38 +07:00
parent 674e5f0339
commit 4915b833e7
12 changed files with 178 additions and 142 deletions

View File

@@ -62,7 +62,7 @@ export function TextNote(props: { content?: string }) {
}
},
}}
disallowedElements={['h1', 'h2', 'h3', 'h4', 'h5', 'h6']}
disallowedElements={['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'code']}
unwrapDisallowed={true}
linkTarget={'_blank'}
>

View File

@@ -1,7 +1,5 @@
import { Link } from 'react-router-dom';
import { Image } from '@shared/image';
import { useOpenGraph } from '@utils/hooks/useOpenGraph';
export function LinkPreview({ urls }: { urls: string[] }) {
@@ -38,10 +36,13 @@ export function LinkPreview({ urls }: { urls: string[] }) {
) : (
<>
{data.image && (
<Image
<img
src={data.image}
alt={urls[0]}
className="h-44 w-full rounded-t-lg object-cover"
loading="lazy"
decoding="async"
style={{ contentVisibility: 'auto' }}
/>
)}
<div className="flex flex-col gap-1 border-t border-white/5 px-3 py-3">

View File

@@ -1,4 +1,9 @@
import { MediaPlayer, MediaProvider } from '@vidstack/react';
import { MediaPlayer, MediaProvider, Poster } from '@vidstack/react';
import {
DefaultAudioLayout,
DefaultVideoLayout,
defaultLayoutIcons,
} from '@vidstack/react/player/layouts/default';
export function VideoPreview({ urls }: { urls: string[] }) {
return (
@@ -7,12 +12,20 @@ export function VideoPreview({ urls }: { urls: string[] }) {
<MediaPlayer
key={url}
src={url}
poster={`https://thumbnail.video/api/get?url=${url}&seconds=1`}
load="visible"
aspectRatio="16/9"
crossorigin=""
className="player"
>
<MediaProvider />
<MediaProvider>
<Poster
className="vds-poster"
src="https://thumbnail.video/api/get?url=${url}&seconds=1"
alt={url}
/>
</MediaProvider>
<DefaultAudioLayout icons={defaultLayoutIcons} />
<DefaultVideoLayout icons={defaultLayoutIcons} />
</MediaPlayer>
))}
</div>