Compare commits

..

2 Commits

Author SHA1 Message Date
Balázs Úr
1da92addd2 fix: Hungarian translations (#7434)
Co-authored-by: Dhruwang <dhruwangjariwala18@gmail.com>
2026-03-09 12:31:24 +00:00
Dhruwang Jariwala
1e4aa5f54b fix: strip inline styles preserve target attr (#7441)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 12:09:51 +00:00
2 changed files with 6 additions and 0 deletions

View File

@@ -31,6 +31,9 @@ export const stripInlineStyles = (html: string): string => {
// This is more secure than regex-based approaches and handles edge cases properly
return DOMPurify.sanitize(html, {
FORBID_ATTR: ["style"],
// Preserve the target attribute (e.g. target="_blank" on links) which is not
// in DOMPurify's default allow-list but is explicitly required downstream.
ADD_ATTR: ["target"],
// Keep other attributes and tags as-is, only remove style attributes
KEEP_CONTENT: true,
});

View File

@@ -14,6 +14,9 @@ export const stripInlineStyles = (html: string): string => {
// This is more secure than regex-based approaches and handles edge cases properly
return DOMPurify.sanitize(html, {
FORBID_ATTR: ["style"],
// Preserve the target attribute (e.g. target="_blank" on links) which is not
// in DOMPurify's default allow-list but is explicitly required downstream.
ADD_ATTR: ["target"],
// Keep other attributes and tags as-is, only remove style attributes
KEEP_CONTENT: true,
});