Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update render-campaign-email-html.ts

Kiran Ked71de26435c
diff --git a/apps/web/lib/api/workflows/render-campaign-email-html.ts b/apps/web/lib/api/workflows/render-campaign-email-html.ts
index 5d16e802e3..335c905e82 100644
--- a/apps/web/lib/api/workflows/render-campaign-email-html.ts
+++ b/apps/web/lib/api/workflows/render-campaign-email-html.ts
@@ -48,8 +48,22 @@ export function renderCampaignEmailHTML({
}),
]);
+ const htmlWithListStyles = html
+ .replace(
+ /<ul([^>]*)>/g,
+ '<ul$1 style="padding-left: 30px; margin-left: 0;">',
+ )
+ .replace(
+ /<ol([^>]*)>/g,
+ '<ol$1 style="padding-left: 30px; margin-left: 0;">',
+ )
+ .replace(
+ /<li([^>]*)>/g,
+ '<li$1 style="margin-left: 0; padding-left: 4px; margin-top: 0px; margin-bottom: 0px; line-height:1;">',
+ );
+
return interpolateEmailTemplate({
- text: sanitizeHtmlBody(html),
+ text: sanitizeHtmlBody(htmlWithListStyles),
variables,
});
}
@@ -71,6 +85,9 @@ const sanitizeHtmlBody = (body: string) => {
allowedAttributes: {
a: ["href", "name", "target", "rel"],
img: ["src", "alt", "title"],
+ ul: ["style"],
+ ol: ["style"],
+ li: ["style"],
"*": ["class"],
},
allowedSchemes: ["http", "https", "mailto"],