Commit Graph

60 Commits

Author SHA1 Message Date
Rostislav Wolny
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
Rostislav Wolny
4b55bb5bb3 Move default core/button styles configuration to integration
[MAILPOET-5814]
2024-01-23 16:47:48 +01:00
Rostislav Wolny
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
Rostislav Wolny
daf2d9f854 Update button renderer to read font size set by preprocessor
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
Rostislav Wolny
c4586d60e9 Move the default font family and font size settings to the theme.json
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
Rostislav Wolny
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
Rostislav Wolny
3cb469a11b Apply font-family set by user in button block
[MAILPOET-5740]
2024-01-23 16:47:48 +01:00
Jan Lysý
6dba7b3afc Use min function for better readability
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
1030d521c0 Use constant from SettingsController in image renderer
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
932f47b763 Fix image block rendering when image is not set
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
2fc3860512 Fix background color for full-width columns
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
fb2d89cb81 Fix rendering images with higher width than newsletter
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
da16f50d33 Refactor core/image renderer for better compatibility with Outlook
[MAILPOET-5788]
2024-01-16 12:22:54 +01:00
Jan Lysý
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
Rostislav Wolny
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
Rostislav Wolny
0e10e6ed24 Use isset instead ?? operator in button renderer
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
9522a55460 Apply font color from the preprocessor in the button block
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
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
Rostislav Wolny
8054088852 Unify styles processing in button renderer with other blocks
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
7329826d39 Skip rendering of empty buttons
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
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
Rostislav Wolny
820af6454b Extract flex layout rendering functionality to an extra class
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
486f497290 Apply text-decoration in the button renderer from preprocessor
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
9d35863fd0 Render buttons with borders with the correct width
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
499db0034c Remove forgotten bdumps from image block
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
a359c1e392 Improve font styles rendering in button
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
bfa7b509cc Add buttons block rendering
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
195756c0c7 Add renderer for core/button block
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Rostislav Wolny
3a74c1c4a0 Enable blocks and register dummy button/buttons renderers
[MAILPOET-5644]
2024-01-08 09:21:16 +01:00
Jan Lysý
df9c3f5890 Add comments about color variables conversion
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
d4e2836a9d Unify typehint by BlockRenderer interface
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
61892595ee Fix blocks width across email clients
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
efd9abcf76 Skip width style setting in blocks paragraph and heading
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
61e8d2d200 Implement rendering block core/paragraph
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
3228ae5794 Fix stretch alignment for the column/core block
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
445f7545a1 Reuse function from SettingsController in Heading renderer
[MAILPOET-5642]
2024-01-05 10:17:23 +01:00
Jan Lysý
832ffc1568 Add layout left and right padding to columns block
Because side paddings were removed from template.html it was necessary add them to the columns block to correct compatibility across different email client.
[MAILPOET-5688]
2023-12-21 13:04:10 +01:00
Jan Lysý
2ce746a156 Fix getting style attribute in the image block
In some cases wasn't the style attribute set and it caused type error in calling method for parsing styles.
[MAILPOET-5688]
2023-12-21 13:04:10 +01:00
Jan Lysý
7792331999 Add rendering improvements for Outlook
[MAILPOET-5705]
2023-11-27 12:54:30 +01:00
Jan Lysý
abf1ef9d7f Implements image block renderer
[MAILPOET-5705]
2023-11-27 12:54:30 +01:00
Jan Lysý
328fcfa260 Move method for composing styles to SettingsController
To avoid repetition I decided to move this method to better place.
[MAILPOET-5705]
2023-11-27 12:54:30 +01:00
Jan Lysý
8bab89b4e8 Add default image block renderer
[MAILPOET-5705]
2023-11-27 12:54:30 +01:00
Oluwaseun Olorunsola
0d771a7fc5 Add support for creating styles from block attributes e.g., text alignment styles
MAILPOET-5643
2023-11-17 09:49:06 +01:00
Oluwaseun Olorunsola
667da710b1 Merge updates in trunk
MAILPOET-5643
2023-11-17 09:49:06 +01:00
Oluwaseun Olorunsola
1a6caac290 Add heading block support to email editor
MAILPOET-5643
2023-11-17 09:49:06 +01:00
Jan Lysý
5ed3656032 Add vertical-alignment style to core/column renderer
[MAILPOET-5690]
2023-11-13 06:58:52 +01:00
Jan Lysý
db13c4ba25 Unify wrapping method name
[MAILPOET-5645]
2023-11-11 09:38:35 +04:00
Jan Lysý
f96b02146c Refactor paragraph renderer to table
Because we are facing issues with Outlook, we decided to use table design when it's possible
[MAILPOET-5645]
2023-11-11 09:38:35 +04:00
Jan Lysý
60fd4b6c8a Add List block renderer
[MAILPOET-5645]
2023-11-11 09:38:35 +04:00
Rostislav Wolny
219a12578a Simplify API for registering email block renderers
This commit makes the cleanup of filters for block rendering in emails automatic.
[MAILPOET-5645]
2023-11-10 08:44:08 +01:00