Improve article embedding by allowing YouTube videos and adding accessibility attributes

Allow YouTube embeds in articles by updating DOMPurify configuration to include the 'title' attribute for iframes and ensuring proper sanitization.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 517dfa7b-26ac-463d-a6e1-a58c6df97188
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 4b93164f-6fc8-4e6f-b10f-1f5cff30e9c0
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/f209e72a-0939-48fa-84fc-57854de71967/517dfa7b-26ac-463d-a6e1-a58c6df97188/jdAEdU5
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sebastjanartic 2026-03-04 11:43:32 +00:00
parent 87797a2ffa
commit 2f2a80189e
2 changed files with 1 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

View File

@ -26,7 +26,7 @@ const ALLOWED_IFRAME_DOMAINS = [
function sanitizeContent(html: string): string {
return DOMPurify.sanitize(html, {
ADD_TAGS: ["iframe", "blockquote"],
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "src", "loading", "style", "class", "data-instgrm-permalink", "data-instgrm-version", "data-instgrm-captioned", "cite"],
ADD_ATTR: ["allow", "allowfullscreen", "frameborder", "scrolling", "src", "loading", "style", "class", "title", "data-instgrm-permalink", "data-instgrm-version", "data-instgrm-captioned", "cite"],
ALLOW_UNKNOWN_PROTOCOLS: false,
});
}