fix(email-viewer): stop styled emails gluing to the corner#595
Open
shukiv wants to merge 1 commit into
Open
Conversation
Member
|
not sure, i want this as a setting i think |
Contributor
Author
|
Makes sense. Two ways to slice it: 1. Keep the refined detection as the default + add an override setting — e.g. Message spacing: Auto / Always / Edge-to-edge, Auto = this PR's heuristic. Works out of the box, power users can force either extreme. 2. Drop the heuristic, plain toggle — "Add padding around message content" (default on). Simpler, but full-bleed newsletters with a coloured canvas get a white frame when it's on. I'd lean to (1) with Auto as default. Happy to build whichever you prefer — which do you want? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The read-view zeroes the iframe body padding whenever an email contains a
<style>tag (hasOwnLayout = hasStyleTag && !isWordHtml), assuming such mails bring their own layout. But many transactional emails ship a<style>block only for web fonts and have no outer gutter of their own — so their content renders flush against the top-left corner.Example: a Namecheap order-summary receipt (has a
<style>block, wrapper is a plain<div>, order table iswidth="95%", no background) rendered glued to the edge.Fix
A
<style>tag alone is too weak a signal. Only drop the default gutter when the email paints a full-bleed background canvas — awidth:100%element carrying a background colour — which is the one case where our padding shows as an ugly frame around the email's own background. Otherwise keep the1rem 1.25remgutter.Testing
<style>+ no full-bleed canvas): now gets the gutter ✅width:100%bgcolor canvas: still edge-to-edge (no white frame) ✅tscclean; lint clean