Skip to content

feat(email-viewer): message spacing setting (auto/always/edge-to-edge) - #660

Merged
rathlinus merged 1 commit into
bulwarkmail:mainfrom
shukiv:feat/message-spacing-setting
Jul 21, 2026
Merged

feat(email-viewer): message spacing setting (auto/always/edge-to-edge)#660
rathlinus merged 1 commit into
bulwarkmail:mainfrom
shukiv:feat/message-spacing-setting

Conversation

@shukiv

@shukiv shukiv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #595, built the way you asked ("i want this as a setting").

The problem (from #595)

The reader zeroes the message-body gutter whenever an email contains a <style> tag (hasOwnLayout = hasStyleTag && !isWordHtml). Plenty of transactional mails ship a <style> block only for web fonts and have no gutter of their own, so their content renders glued to the top-left corner (a Namecheap order receipt was the reported case).

The setting

New Message Spacing option under Settings → Reading:

Mode Behaviour
Auto (default) Add the gutter unless the email paints a full-bleed background canvas — a width:100% element carrying a background colour — which is the one case where our gutter shows as a frame around the email's own background
Always add spacing Always keep the gutter
Edge to edge Never add one (previous behaviour for styled mail)

Auto keeps it working out of the box; the two explicit modes let users force either extreme. A <style> tag alone is no longer treated as "this mail brings its own layout".

Changes

  • stores/settings-store.tsMessageSpacing type, messageSpacing state (default 'auto'), added to the persist allowlist
  • components/email/email-viewer.tsx — full-bleed-canvas detection drives auto; setting overrides it; added to the srcDoc memo deps
  • components/settings/reading-settings.tsx — Select control (respects the existing policy lock/hide hooks)
  • i18n: settings.email_behavior.message_spacing.* (en + he)

Testing

  • Namecheap-style receipt (<style>, no full-bleed canvas) → Auto gives it the gutter
  • Newsletter with a width:100% bgcolor canvas → Auto stays edge-to-edge (no white frame)
  • Always / Edge to edge override both cases; setting persists across reload
  • Bare HTML and Word/Outlook HTML unchanged
  • tsc clean; lint clean (no new warnings)

@rathlinus
rathlinus merged commit 53461d1 into bulwarkmail:main Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants