Add email background and width into StylesController and apply in redering

[MAILPOET-5540]
This commit is contained in:
Rostislav Wolny
2023-09-15 14:41:57 +02:00
committed by Jan Lysý
parent 77eab47357
commit fd96b4afad
6 changed files with 80 additions and 14 deletions

View File

@@ -3,13 +3,25 @@
namespace MailPoet\EmailEditor\Engine;
class StylesController {
/**
* Width of the email in pixels.
* @var int
*/
const EMAIL_WIDTH = 660;
/**
* Width of the email in pixels.
* @var string
*/
const EMAIL_BACKGROUND = '#cccccc';
/**
* Default styles applied to the email. These are going to be replaced by style settings.
* This is currently more af a proof of concept that we can apply styles to the email.
* We will gradually replace these hardcoded values with styles saved as global styles or styles saved with the email.
* @var string
*/
const DEFAULT_EMAIL_STYLES = "
const DEFAULT_EMAIL_CONTENT_STYLES = "
body { font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; }
p { font-size: 16px; }
h1 { font-size: 32px; }
@@ -20,7 +32,17 @@ class StylesController {
h6 { font-size: 12px; }
";
public function getEmailStyles(): string {
return self::DEFAULT_EMAIL_STYLES;
public function getEmailContentStyles(): string {
return self::DEFAULT_EMAIL_CONTENT_STYLES;
}
/**
* @return array{width: int, background: string}
*/
public function getEmailLayoutStyles(): array {
return [
'width' => self::EMAIL_WIDTH,
'background' => self::EMAIL_BACKGROUND,
];
}
}