Introduce file for sharing CSS for content between editor and renderer

[MAILPOET-6249]
This commit is contained in:
Rostislav Wolny
2024-10-22 13:19:52 +02:00
committed by Jan Lysý
parent b87eb3edd3
commit 95f7049bd9
4 changed files with 18 additions and 0 deletions

View File

@@ -89,6 +89,7 @@ class ContentRenderer {
*/
private function inlineStyles($html, WP_Post $post, $template = null) {
$styles = (string)file_get_contents(dirname(__FILE__) . '/' . self::CONTENT_STYLES_FILE);
$styles .= (string)file_get_contents(dirname(__FILE__) . '/../../content-shared.css');
// Apply default contentWidth to constrained blocks.
$layout = $this->themeController->getLayoutSettings();

View File

@@ -56,8 +56,10 @@ class SettingsController {
// Assets for iframe editor (component styles, scripts, etc.)
$settings['__unstableResolvedAssets'] = $this->iframeAssets;
$editorContentStyles = file_get_contents(__DIR__ . '/content-editor.css');
$sharesContentStyles = file_get_contents(__DIR__ . '/content-shared.css');
$settings['styles'] = [
['css' => $editorContentStyles],
['css' => $sharesContentStyles],
];
$settings['__experimentalFeatures'] = $themeSettings;

View File

@@ -0,0 +1,15 @@
/*
* Styles for both the email editor and renderer.
*/
/* Automatic padding for blocks with background color */
.email-text-block.has-background,
p.has-background,
h1.has-background,
h2.has-background,
h3.has-background,
h4.has-background,
h5.has-background,
h6.has-background {
padding: 16px 24px;
}