feat(postcard): inline mail CSS at render with a per-layout opt-out

- github.com/vanng822/go-premailer v1.38.0 (default options) inlines the
  rendered HTML after the safety checks; the result is checked again,
  HTML without a style element is left as it is, an inliner error sends
  the style block only and warns (key inline:<layout>)
- opt-out: layout header key disable_auto_inline_css, the layouts column
  of the same name (migration 202611130003), LayoutFile/LayoutOverride/
  Draft.DisableAutoInlineCSS; SyncIndex mirrors and ResetOverride restores
  the file's value
- cabana layout form switch on the CSS tab, mapped into the layout draft
  and the save validation; en/pl copy
- tests: TestMailPartialsSmoke/inline, TestMailEditorSmoke/inline_flag,
  the layouts switch in TestMailScreensSmoke; CSS-slot tests read the
  style block through a no-op inliner
- 35-06 Task 2 (G-35-8)
This commit is contained in:
Jakub Zych
2026-11-13 21:12:01 +01:00
parent dcd0ae5338
commit d320733510
22 changed files with 551 additions and 85 deletions

View File

@@ -673,6 +673,8 @@ mail:
text_comment: "Wraps the plain-text message. Put {{ .Content }} where the message goes."
css: "CSS"
css_comment: "Styles for this layout. They are inlined into the HTML message after the branding styles."
disable_inline_css: "Do not inline CSS"
disable_inline_css_comment: "By default the CSS is also copied into each element's style attribute, so mail clients that drop the style block still show it. Turn this on to keep the style block only."
delete_confirm: "Delete this layout? This cannot be undone. A layout that customized templates still use cannot be deleted."
reset_confirm: "Reset this layout to the file version? Your HTML, plain-text and CSS changes are deleted, and unsaved edits on this page are discarded. This cannot be undone."
delete_in_use:

View File

@@ -709,6 +709,8 @@ mail:
text_comment: "Otacza wiadomość tekstową. Wstaw {{ .Content }} w miejscu treści."
css: "CSS"
css_comment: "Style tego układu. Są wstawiane do wiadomości HTML po stylach wyglądu."
disable_inline_css: "Nie wstawiaj CSS do elementów"
disable_inline_css_comment: "Domyślnie CSS jest też kopiowany do atrybutu style każdego elementu, aby klienty poczty usuwające blok stylów nadal go pokazywały. Włącz, aby zostawić tylko blok stylów."
delete_confirm: "Usunąć ten układ? Tej operacji nie można cofnąć. Nie można usunąć układu, którego używają dostosowane szablony."
reset_confirm: "Przywrócić wersję układu z pliku? Twoje zmiany HTML, tekstu i CSS zostaną usunięte, a niezapisane zmiany na tej stronie odrzucone. Tej operacji nie można cofnąć."
delete_in_use: