From 0c972d8276c3701980d7966c5d35d1b3df4bdf90 Mon Sep 17 00:00:00 2001 From: Chris Raible Date: Wed, 1 Nov 2023 15:05:39 -0700 Subject: [PATCH] Fixed EmailRenderer stripping inline width tags from images (#18587) no issue - product card outputs the original width/height of the image in emails which results in overflown images in Outlook - Combined with https://github.com/TryGhost/Koenig/pull/983/files, this change fixes rendering for product card images in Outlook --------- Co-authored-by: Sodbileg Gansukh --- ghost/email-service/lib/EmailRenderer.js | 4 ++-- .../email-service/lib/email-templates/partials/styles-old.hbs | 3 +-- ghost/email-service/lib/email-templates/partials/styles.hbs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ghost/email-service/lib/EmailRenderer.js b/ghost/email-service/lib/EmailRenderer.js index 83e384fe51..54f793cf83 100644 --- a/ghost/email-service/lib/EmailRenderer.js +++ b/ghost/email-service/lib/EmailRenderer.js @@ -370,8 +370,8 @@ class EmailRenderer { // Juice HTML (inline CSS) const juice = require('juice'); - juice.heightElements = ['TABLE', 'TD', 'TH']; - juice.widthElements = ['TABLE', 'TD', 'TH']; + juice.heightElements = ['TABLE', 'TD', 'TH', 'IMG']; + juice.widthElements = ['TABLE', 'TD', 'TH', 'IMG']; html = juice(html, {inlinePseudoElements: true, removeStyleTags: true}); // happens after inlining of CSS so we can change element types without worrying about styling diff --git a/ghost/email-service/lib/email-templates/partials/styles-old.hbs b/ghost/email-service/lib/email-templates/partials/styles-old.hbs index 2a1ed4746b..fa0fdcdf40 100644 --- a/ghost/email-service/lib/email-templates/partials/styles-old.hbs +++ b/ghost/email-service/lib/email-templates/partials/styles-old.hbs @@ -637,8 +637,7 @@ a[data-flickr-embed] img { .kg-image-card img { display: block; margin: 0 auto; - width: auto; - height: auto !important; + height: auto; } .kg-bookmark-container { diff --git a/ghost/email-service/lib/email-templates/partials/styles.hbs b/ghost/email-service/lib/email-templates/partials/styles.hbs index 28d0580683..010493db05 100644 --- a/ghost/email-service/lib/email-templates/partials/styles.hbs +++ b/ghost/email-service/lib/email-templates/partials/styles.hbs @@ -685,8 +685,8 @@ a[data-flickr-embed] img { .kg-image-card img { display: block; margin: 0 auto; - width: auto; - height: auto !important; + /* width: auto; + height: auto !important; */ } .kg-bookmark-container {