Fix video embeds to display correctly in articles
Update DOMPurify to allow the 'style' attribute on iframes and adjust CSS to correctly handle vertical video aspect ratios, ensuring proper display of embedded content. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 413891e8-d784-4bea-b9f5-91a5a68316b4 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 59104823-d3a5-43b2-b639-53c5c8511b1a Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/413891e8-d784-4bea-b9f5-91a5a68316b4/cftwqyT Replit-Helium-Checkpoint-Created: true
This commit is contained in:
parent
8cad711d11
commit
000edc48e5
BIN
attached_assets/image_1772297393060.png
Normal file
BIN
attached_assets/image_1772297393060.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 717 KiB |
@ -25,7 +25,7 @@ const ALLOWED_IFRAME_DOMAINS = [
|
||||
function sanitizeContent(html: string): string {
|
||||
return DOMPurify.sanitize(html, {
|
||||
ADD_TAGS: ["iframe"],
|
||||
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "src", "loading"],
|
||||
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "src", "loading", "style"],
|
||||
ALLOW_UNKNOWN_PROTOCOLS: false,
|
||||
});
|
||||
}
|
||||
@ -178,9 +178,8 @@ export default function ArticlePage() {
|
||||
prose-a:text-primary prose-a:no-underline hover:prose-a:underline
|
||||
prose-strong:text-foreground
|
||||
prose-img:rounded-md prose-img:w-full prose-img:object-cover
|
||||
[&_iframe]:w-full [&_iframe]:aspect-video [&_iframe]:rounded-md [&_iframe]:my-6
|
||||
[&_.embed-container]:relative [&_.embed-container]:w-full [&_.embed-container]:my-6
|
||||
[&_.embed-container_iframe]:absolute [&_.embed-container_iframe]:inset-0 [&_.embed-container_iframe]:w-full [&_.embed-container_iframe]:h-full
|
||||
[&_iframe]:rounded-md [&_iframe]:my-6 [&_iframe]:max-w-full
|
||||
[&_div[style]]:flex [&_div[style]]:justify-center
|
||||
[&_blockquote]:border-l-primary [&_blockquote]:bg-accent/50 [&_blockquote]:rounded-r-md [&_blockquote]:py-1"
|
||||
dangerouslySetInnerHTML={{ __html: sanitizeContent(article.content) }}
|
||||
data-testid="article-content"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user