Commit Graph

160 Commits

Author SHA1 Message Date
b90a35d80a Add definition of default heading font-sizes and renderer support
Initially, I tried to place the definition to theme.json
(It could set it in styles.block.core/heading or styles.elements.h1...)
It was not possible to use theme.json because of the fluid typography
feature which, when enabled for a site, causes font sizes to being
converted to the fluid definition (clamp(x, y, z)) and which
is not usable for an email due to very little client support.

We need to make some changes in Gutenberg to be able to disable the feature.
Currently, the code for generating font sizes in CSS generated from the theme.json
looks directly at the global settings of the site.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
6f3ebc10b8 Remove unnecessary editor styles
These styles were later overwritten by $editorTheme->get_stylesheet()
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
89a02fce39 Remove unnecessary settings in the DEFAULT_SETTINGS constant
These settings are later completely replaced by settings generated
from theme.json
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
4b55bb5bb3 Move default core/button styles configuration to integration
[MAILPOET-5814]
2024-01-23 16:47:48 +01:00
0daf720d34 Add hook for changing default theme for email editor
[MAILPOET-5814]
2024-01-23 16:47:48 +01:00
cd274c0738 Add basic style for buttons
Default background rendering has to be handled on the button renderer level
because of a specific markup for Outlook (bgcolor attribute). Default text color and paddings are
handled via CSS inlining. That's why they are tested in RendererTest

I used the same background color and font color as the one defined for the button
element in WP core theme.json, and I also used similar padding values
(In core they use "calc(0.667em + 2px) calc(1.333em + 2px)")
[MAILPOET-5814]
2024-01-23 16:47:48 +01:00
b9b57cc574 Refactor getSettings to work with the mered theme
The method was loading both themes separately. This commit changes
the behavior so that it uses only the email theme which contains
also the core theme settings.
Instead of modifying the core theme settings in PHP we can now
move these settings into the email editor theme, which is merged
into the core theme.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
512d47609e Use merged theme in renderer CSS and for font-size slug translation
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
55dd1d0ab0 Improve getTheme to return merged core theme + email theme
The idea is that the core theme is a base and we add email-specific
modifications on top of and create a core email theme.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
0e04a892c2 Inline style declaration from font-size classes
This is needed for cases where we don't touch the HTML output
to insert font size from the preprocessor (e.g., list item)
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
daf2d9f854 Update button renderer to read font size set by preprocessor
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
a472df257a Replace font size slugs with values in typography preprocessor
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
d62f3c1938 Render email main font family CSS rules in the content wrapper
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
2573042431 Remove default content styles
These are no longer needed.
I also found that the settings for font-size for headings were
not used anywhere.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
c4586d60e9 Move the default font family and font size settings to the theme.json
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
07e6940162 Add the basic list of font families
Add basic font families. For now, we use know-how from the current editor
and we use the same list of fonts as were used in the current editor
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
e8bb1b5ac0 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]
2024-01-23 16:47:48 +01:00
a7aaf97070 Improve typography preprocessor to get font family value from slugs
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
3cb469a11b Apply font-family set by user in button block
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
890050fdc8 Fix font-family processing in the typography preprocessor.
The font-family property is not included under styles but at the top level
of block attributes.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
429f0ce081 Enable font family selection in email editor
Initially, we use just basic serif and sans serif fonts.
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
db9813a3aa Remove gradients from the new email editor
[MAILPOET-5824]
2024-01-19 13:13:27 +01:00
6dba7b3afc Use min function for better readability
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
1030d521c0 Use constant from SettingsController in image renderer
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
932f47b763 Fix image block rendering when image is not set
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
2fc3860512 Fix background color for full-width columns
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
fb2d89cb81 Fix rendering images with higher width than newsletter
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
da16f50d33 Refactor core/image renderer for better compatibility with Outlook
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
b35e0af691 Remove old code that was handling creating emails for the new editor
The code is no longer needed because the new emails are created via API.
[MAILPOET-5810]
2024-01-14 19:43:26 +05:00
b68df77aee Simplify ListBlock renderer
Because for nesting is better to doesn't have any wrapper, we add configured styles directly to the list tag
[MAILPOET-5790]
2024-01-11 14:39:08 +01:00
9c87ec233f Add comment about numeric values in BlocksWidthPreprocessor
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
6368496de1 Render font size on button instead of buttons wrapper
Font size on the wrapper was causing whitespace below the buttons block.
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
7cbc130893 Pass default font-size in email attrs in TypographyPreprocessor
It is convenient to always know font-size in nested blocks so that we don't
have to read it from the settings controller.
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
0e10e6ed24 Use isset instead ?? operator in button renderer
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
9522a55460 Apply font color from the preprocessor in the button block
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
327a23ca81 Improve typography preprocessor to distribute font color from theme.json
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
9b05e46690 Use theme.json defined background in renderer
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
280ad2e159 Add base text and background color to theme.json
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
16da082c42 Add schema to email editor theme.json
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
70273c626d Add Button renderer test
This commit adds a button renderer test and fixes a couple of issues
found when working on the test
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
8054088852 Unify styles processing in button renderer with other blocks
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
7329826d39 Skip rendering of empty buttons
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
becb5243d5 Remove witdh:100% from columns wrapper
This was causing incorrect width in cases when $layoutPaddingLeft
and $layoutPaddingRight were set. Box-sizing doesn't have proper
support in clients, so I tried to fix it by removing 100% of the width.
According to tests in AcidEmail, this shouldn't break anything.

This was introduced when we added full-width alignment.
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
c5ad2405aa Add Flex Renderer test
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
820af6454b Extract flex layout rendering functionality to an extra class
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
486f497290 Apply text-decoration in the button renderer from preprocessor
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
b626252b39 Add support for text decoration to typography preprocessor 2024-01-08 09:21:16 +01:00
9d35863fd0 Render buttons with borders with the correct width
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
2032370f03 Add default core editor styles
We accidentally removed them when adding layout styles.
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
499db0034c Remove forgotten bdumps from image block
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00