Refactor font family rendering using CSS inlining

We don't reset font family on any level, so there is no need to
bubble the setting using a preprocessor and render the inline styles
explicitly in every block.

In this commit, I change how font-family settings are distributed/rendered
in the email renderer. In the new approach, we rely on class names defining font-family
and a generated CSS sheet with font-family definitions.
We apply the font-family CSS by inlining CSS rules for families in the later phase of
rendering after all individual blocks are processed.
[MAILPOET-5740]
This commit is contained in:
Rostislav Wolny
2024-01-11 17:08:12 +01:00
committed by Jan Lysý
parent a7aaf97070
commit e8bb1b5ac0
10 changed files with 38 additions and 47 deletions

View File

@@ -0,0 +1,19 @@
<?php declare(strict_types = 1);
namespace MailPoet\EmailEditor\Engine;
class SettingsControllerTest extends \MailPoetTest {
/** @var SettingsController */
private $settingsController;
public function _before() {
parent::_before();
$this->settingsController = $this->diContainer->get(SettingsController::class);
}
public function testItGeneratesCssStylesForThemeWithFontFamilies() {
$css = $this->settingsController->getStylesheetForRendering();
verify($css)->stringContainsString('.has-system-sans-serif-font-family');
verify($css)->stringContainsString('.has-system-Serif-font-family');
}
}