mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed card spacing and caption styling for member emails in Outlook
closes https://github.com/TryGhost/Ghost/issues/12139 - once the email content has been rendered in the post serializer, perform some whole-content transformation of `figure` and `figcaption` to `div` using cheerio - juiced will have already inlined the elements styles so there's no need to adjust the template's stylesheet
This commit is contained in:
parent
616767d0ec
commit
d8e319af88
1 changed files with 5 additions and 1 deletions
|
@ -136,9 +136,13 @@ const serialize = async (postModel, options = {isBrowserPreview: false}) => {
|
||||||
const juiceOptions = {inlinePseudoElements: true};
|
const juiceOptions = {inlinePseudoElements: true};
|
||||||
let juicedHtml = juice(htmlTemplate, juiceOptions);
|
let juicedHtml = juice(htmlTemplate, juiceOptions);
|
||||||
|
|
||||||
// Force all links to open in new tab
|
// convert juiced HTML to a DOM-like interface for further manipulation
|
||||||
|
// happens after inlining of CSS so we can change element types without worrying about styling
|
||||||
let _cheerio = cheerio.load(juicedHtml);
|
let _cheerio = cheerio.load(juicedHtml);
|
||||||
|
// force all links to open in new tab
|
||||||
_cheerio('a').attr('target','_blank');
|
_cheerio('a').attr('target','_blank');
|
||||||
|
// convert figure and figcaption to div so that Outlook applies margins
|
||||||
|
_cheerio('figure, figcaption').each((i, elem) => (elem.tagName = 'div'));
|
||||||
juicedHtml = _cheerio.html();
|
juicedHtml = _cheerio.html();
|
||||||
|
|
||||||
// Fix any unsupported chars in Outlook
|
// Fix any unsupported chars in Outlook
|
||||||
|
|
Loading…
Add table
Reference in a new issue