Commit Graph

178 Commits

Author SHA1 Message Date
Oluwaseun Olorunsola
a28ff7da50 Refactor Send_Preview_Email to add support for reusability
MAILPOET-6323
2025-01-29 08:42:48 +01:00
Oluwaseun Olorunsola
ecb040c4a4 Add basic support for email custom post-type post-template.
The template will be used when previewing email editor posts

MAILPOET-6323
2025-01-29 08:42:48 +01:00
Rostislav Wolny
dadf76c519 Ensure we preserve post types in response eventually added by other plugins
[MAILPOET-6445]
2025-01-27 15:24:56 +01:00
Rostislav Wolny
14e5a82a49 Fix condition for adding post_types to API response for templates
The wrong condition was causing we added the data to more templates.
They were then displayed in the select template modal.
[MAILPOET-6445]
2025-01-27 15:24:56 +01:00
Pavel Dohnal
74f2281ff0 Remove item from the readme
[MAILPOET-6429]
2025-01-27 13:55:23 +01:00
Jan Lysý
2070b502ad Fix type in Initializer::allow_styles()
[MAILPOET-6426]
2025-01-17 13:15:53 +01:00
Jan Lysý
05bf20ec20 Update strict spacing condition
The more strict condition does not work properly for the group block, and the default column patterns were broken.
[MAILPOET-6364]
2025-01-13 15:35:17 +01:00
Rostislav Wolny
a8a412b405 Add Todo for content validation
[MAILPOET-6393]
2025-01-13 11:34:21 +01:00
Oluwaseun Olorunsola
78a632d1bc Ensure we only register block template when required
MAILPOET-6366
2025-01-10 18:39:26 +01:00
Rostislav Wolny
735baa2e73 Remove the Gutenberg version check from editor dependencies
MailPoet itself requires 6.6 to activate, so the oldest Gutenberg version we could get is 19.6, which is the first that allows WP 6.6 and could be active together with MailPoet. So, we are safe to remove the check for the Gutenberg version for now.
[MAILPOET-6367]
2025-01-09 19:31:49 +01:00
Rostislav Wolny
0cb66ecc40 Update the dependency check logic and the message
We actually need WP 6.7 and above, no matter what Gutenberg version
is installed. This commit updates the check logic and the warning
message to match this requirement.
[MAILPOET-6367]
2025-01-09 19:31:49 +01:00
Rostislav Wolny
37ceec2277 Fix the Gutenberg version check to use the correct version
[MAILPOET-6367]
2025-01-09 19:31:49 +01:00
Rostislav Wolny
dd2c88dfbe Add service for checking editor dependencies
[MAILPOET-6367]
2025-01-09 19:31:49 +01:00
Jan Lysý
5decd55bf7 Improve CSS selectors for spacing inside columns and group blocks
[MAILPOET-6364]
2025-01-09 15:35:59 +01:00
Jan Lysý
780c72d092 Remove default align center from group block
Because the group block has deactivated layout settings in the email editor. It is not possible to configure content alignment.
The default value center could break blocks inside the group.
[MAILPOET-6412]
2025-01-09 15:32:54 +01:00
Jan Lysý
e429bd99b1 Update styles for mobile preview
I removed some deprecated styles and updated the style affecting images in mobile preview.
[MAILPOET-6368]
2025-01-08 11:12:09 +01:00
Rostislav Wolny
74c52597c5 Remove CSS for classic themes from email editor iframe styles
This removes classic.min.css and theme.min.css. Both are loaded only
when a classic theme is active and add additional paddings and margins
that are not reflected in the email renderer.
[MAILPOET-6390]
2025-01-06 16:52:17 +01:00
Jan Lysý
e7d015895a Add support for replacing Personalization tags in links
[MAILPOET-6394]
2025-01-06 15:46:22 +01:00
Rostislav Wolny
8466897f28 Fix missing block gap above top level blocks in post content
The condition for top level wrappers was too strong and was
causing that top level blocks in post-content block were also skipped.
It seeks that 0 !== $key is sufficent.
[MAILPOET-6334]
2024-12-31 14:09:12 +01:00
Rostislav Wolny
1fbfcf0fb0 Update the default global style background and font color
[MAILPOET-6334]
2024-12-31 14:09:12 +01:00
Rostislav Wolny
132ffde58f Fix saving template associations with emails
The original workaround was not working for templates that have edits saved in the DB.
The problem was that when the template is saved in the DB the get_block_templates()
returns WP_Block_Template object with post_types as null.
It seems this association is not saved to DB in the core.
[MAILPOET-6334]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
30f11dc9cc Use registered email post types for templates instead of hardcoded mailpoet_email
The general email template is registered and works with all post types that are
marked as email post types during editor initialization.
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
2c3932bdd3 Move simple-light template from the engine/package to the free plugin
The additional templates are registered by integrators.
This way, we will be able to use assets like images from MailPoet's CDN
and also various services from the plugins (e.g. CdnAssetsController)
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
6eca06780f Add action for registering email templates
This commit introduces a new action to trigger registering email templates.
We need a custom action for that because the email editor engine controls
when we register templates and when we don't. Currently, we still skip
registering templates when we detect the site editor page.
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
e5aeae7989 Add workaround for saving post-template association for non-block themes
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
9b9187bb3e Move the template_id construction logic to Templates class
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
a5db2564c8 Add post_types field to the template REST API response
We want to use post_type for filtering email templates.
There is a PR that adds this property https://github.com/WordPress/wordpress-develop/pull/7530
but it is not merged.
This commit added the property and also future compatibility check
so that we don't attempt to add it after the PR is merged.
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
ddd2108109 Fix a typo in a method name in Email_Editor
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
2e661f8b8e Remove code that is no longer necessary for the templates to work
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Rostislav Wolny
2fc0ad3c9e Switch template registration to use register_block_template
[MAILPOET-6356]
2024-12-20 15:14:30 +01:00
Jan Lysý
e4c80a09b6 Add new Personalization Tag property defining value to insert
[MAILPOET-6376]
2024-12-20 10:12:04 +01:00
Jan Lysý
a570fa1641 Wrap personalization Tag token with square brackets
Because Gutenberg RichText component does not render square brackets around the HTML comment.
We need to append those brackets to tag tokens and expected them when we replace tags by their values.
[MAILPOET-6354]
2024-12-18 14:15:05 +01:00
Jan Lysý
bcc07c7503 Add API endpoint returning registered personalization tags
[MAILPOET-6354]
2024-12-18 14:15:05 +01:00
Jan Lysý
3ce8e38a00 Remove unused method from Email_editor class
[MAILPOET-6387]
2024-12-18 09:54:39 +01:00
Rostislav Wolny
c64e4caf27 Remove styles data added to templates REST API response
We no longer need to send CSS for every template because we use global styles
live from the editor.
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Rostislav Wolny
ebe7151269 Remove code related to template themes
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Rostislav Wolny
1e1bec4ce0 Use user theme in renderer instead of template themes
We no longer read styles associate with templates when we render an email
but we read the user theme instead
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Rostislav Wolny
15818f37ef Add user theme post cleanup to integration tests
This commit adds automatic cleanup of the user theme post before every test
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Rostislav Wolny
993cbb4fd7 Run cleanup after each integration test
This is needed to get rid of posts created in tests to prevent test interdependency
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Rostislav Wolny
0f7009438c Add User_Theme class for managing user-defined styles and settings
[MAILPOET-6335]
2024-12-17 10:36:39 +01:00
Oluwaseun Olorunsola
cd184c373c Update readme, implement PR feedback
MAILPOET-6256
2024-12-04 14:48:04 +01:00
Oluwaseun Olorunsola
8c2ede4ff9 Update Readme documentation
MAILPOET-6256
2024-12-04 14:48:04 +01:00
Oluwaseun Olorunsola
a5f0dbc2a3 Fix PHPStan and update git-blame-ignore 2024-12-03 09:32:42 +01:00
Oluwaseun Olorunsola
64b550e27d Update Theme_Controller_Test, add case for loading theme.json file
MAILPOET-6043
2024-12-02 14:21:54 +01:00
Oluwaseun Olorunsola
5d6d7eba57 Add template integration tests
MAILPOET-6043
2024-12-02 14:21:54 +01:00
Oluwaseun Olorunsola
b49970e26e Simplify GitHub workflow config for PHPStan
MAILPOET-6318
2024-12-02 08:44:22 +01:00
Oluwaseun Olorunsola
6df51455d2 Fix PHPStan errors
MAILPOET-6318
2024-12-02 08:44:22 +01:00
Oluwaseun Olorunsola
ccc3f9ab28 Ensure phpstan exit code is passed along to the shell window and address some pr comments
MAILPOET-6318
2024-12-02 08:44:22 +01:00
Oluwaseun Olorunsola
b1cc53ec5b Update comments and fix code style warnings
MAILPOET-6318
2024-12-02 08:44:22 +01:00
Oluwaseun Olorunsola
5ce9008f90 Fix PHPStan class-string errors
MAILPOET-6318
2024-12-02 08:44:22 +01:00