Commit Graph

99 Commits

Author SHA1 Message Date
Jan Lysý
c415f1efce Move heading styles from CSS file to theme.json
Because we want to have all editor configurations in theme.json, I moved heading font sized to theme.json and removed redundant filters.
[MAILPOET-5640]
2024-03-15 16:57:41 +01:00
Rostislav Wolny
3bbb7b71a1 Fix border radius issues in the button
When only the radius was defined, we set border solid and it caused
that sometimes it was rendered even when the width was not defined.
Overflow hidden ensures that inner link element doesn't break the border radius.
[MAILPOET-5907
2024-03-15 14:43:01 +01:00
Rostislav Wolny
4071175178 Move ContentRenderer to the Renderer/ContentRenderer namespace
[MAILPOET-5798]
2024-03-15 10:28:48 +01:00
Rostislav Wolny
2c5857e89b Split renderer into content renderer and renderer
Content renderer - renders the content of the email post
Renderer - places the content into the email HTML template and generates text version
[MAILPOET-5798]
2024-03-15 10:28:48 +01:00
Mike Jolley
3defeec415 Rename tableWidth variable 2024-03-13 10:02:00 +01:00
Mike Jolley
9e25796d66 IE column widths 2024-03-13 10:02:00 +01:00
Mike Jolley
3e8edcdc8f Fix border styles 2024-03-13 10:02:00 +01:00
Mike Jolley
bc500812ed Remove max width so table fills full width of layout 2024-03-13 10:02:00 +01:00
Mike Jolley
a922714154 Correctly set default alignment to stretched 2024-03-13 10:02:00 +01:00
Mike Jolley
c75367b996 Merge borders to ensure defaults are set 2024-03-13 10:02:00 +01:00
Mike Jolley
86a9de0df5 Fix extra borders in columns 2024-03-13 10:02:00 +01:00
Mike Jolley
44d95d9e6b Fixing tests and adding debug information to show generated HTML 2024-03-13 10:02:00 +01:00
Mike Jolley
880f157fb0 Update tests due to moving some classnames and styles 2024-03-13 10:02:00 +01:00
Mike Jolley
250f4ad929 Tidy markup 2024-03-13 10:02:00 +01:00
Mike Jolley
27414dfc55 Padding from block styles 2024-03-13 10:02:00 +01:00
Mike Jolley
c4deea8b48 Add background support for columns 2024-03-13 10:02:00 +01:00
Rostislav Wolny
970b321de5 Fix border color fallback for button block
When the border color is not set, a block uses text color as a fallback.
This was not working properly for the button block when the font color was picked from the color palette.
This PR fixes the issue and adds the proper border color class.

[MAILPOET-5919]
2024-03-12 08:38:56 +01:00
Rostislav Wolny
c545dc4967 Refactor applying padding in block renderers
Instead of using our own logic for building padding style definition,
we switch to wp_style_engine_get_styles which generates the styles definitions for us.
It also handles value variable formatting to valid CSS (var:preset|spacing|50 to var(--wp--preset--spacing--50)).
[MAILPOET-5918]
2024-03-05 16:03:49 +01:00
Jan Lysý
db8dac03d2 Prepare styles in store for sidebar
[MAILPOET-5638]
2024-03-01 16:36:52 +01:00
Jan Lysý
075eaab28a Change image caption align to center
We don't need to set the caption align by image alignment. It should be always center.
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Jan Lysý
4caa2f0723 Use WP native function for border style preparation
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Jan Lysý
76e3a20c24 Improve border compatibility across email clients
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Jan Lysý
f9ed604227 Fix setting image width when it's empty
The min function doesn't work properly with strings. Converted widths to numbers should work better here.
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Jan Lysý
53a192b3d8 Add support for rendering image border
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Jan Lysý
9e8647f046 Add support for rendering column and columns borders
[MAILPOET-5821]
2024-02-29 11:05:55 +01:00
Rostislav Wolny
85e4bb2ce8 Remove an unnecessary class from a column wrapper
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
6e887287e5 Remove unused variable from columns block renderer
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
aa658782fb Move getElementInnerHTML from button to DomDocumentHelper
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
febc070c0f Use dom helper for extracting classes from block HTML
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
875fde56e9 Add colors from palette support to the button
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
299d51effa Add support for palette colors for column and columns
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
5ad27b6038 Adjust the list block renderer to support inlined colors
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
330b4c5a6c Adjust Paragraph block to work with inlined color palette CSS
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Rostislav Wolny
2645d57dcb Adjust Paragraph block to work with inlined color palette CSS
[MAILPOET-5741]
2024-02-28 09:01:20 +01:00
Jan Lysý
9106d38aee Add text highlighting support for buttons
[MAILPOET-5809]
2024-02-19 11:18:58 +01:00
Jan Lysý
7fac0e019f Remove line-height CSS styles
Because the line height setting makes the rendered email not look good sometimes.
For now we decided to remove it.
[MAILPOET-5809]
2024-02-19 11:18:58 +01:00
Jan Lysý
d1899090bc Create DomDocumentHelper to work with DOMDocument
[MAILPOET-5831]
2024-02-16 14:18:47 +01:00
Jan Lysý
fc79e3eee9 Implement margin-top for core block renderers
[MAILPOET-5816]
2024-01-24 15:38:13 +01:00
Jan Lysý
eed1dbb695 Fix heading and paragraph background with padding
[MAILPOET-5816]
2024-01-24 15:38:13 +01:00
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