-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Email Editor: Fix color inheritance in Paragraph and Heading blocks #59732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Email Editor: Fix color inheritance in Paragraph and Heading blocks #59732
Conversation
059c878
to
c618e86
Compare
Testing GuidelinesHi @lysyjan , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
📝 WalkthroughWalkthroughThis update addresses the inheritance and resolution of text color attributes in the email editor's Paragraph and Heading blocks. It introduces a fallback mechanism to derive color from block attributes, updates the rendering logic to prioritize inherited colors, and adds integration and unit tests to verify the correct application and propagation of color values. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Renderer
participant Preprocessor
participant SettingsController
User->>Renderer: Render Paragraph/Heading Block
Renderer->>Preprocessor: Preprocess block attributes
Preprocessor->>Preprocessor: Check style.color.text
Preprocessor->>Preprocessor: If not set, check attrs.textColor
Preprocessor->>SettingsController: translate_slug_to_color(slug)
SettingsController-->>Preprocessor: Return color value
Preprocessor-->>Renderer: Return email_attrs with resolved color
Renderer->>Renderer: Use email_attrs['color'] if present
Renderer-->>User: Rendered HTML with correct color style
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (6)
🧰 Additional context used📓 Path-based instructions (1)**/*.{php,js,ts,jsx,tsx}Instructions used from: Sources: 🧠 Learnings (6)📓 Common learnings
packages/php/email-editor/changelog/wooplug-5034-fix-text-color-inheritance-in-paragraph-and-heading-blocks (2)
packages/php/email-editor/src/Integrations/Core/Renderer/Blocks/class-text.php (2)
packages/php/email-editor/tests/unit/Engine/Renderer/ContentRenderer/Preprocessors/Typography_Preprocessor_Test.php (1)
packages/php/email-editor/tests/integration/Integrations/Core/Renderer/Blocks/Heading_Test.php (1)
packages/php/email-editor/src/Engine/Renderer/ContentRenderer/Preprocessors/class-typography-preprocessor.php (2)
🔇 Additional comments (7)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR is currently using
wooplug-4688-add-style-factory-methods-for-emails
as a base branch since it depends on the changes introduced there to properly resolve the issue. That being said, this PR should be considered BLOCKED FOR MERGING until #59678 is merged.$block_attributes['textColor']
) if color style is not specified and pass it to children blocks in the$block_attributes['email_attrs']
.$block_attributes['email_attrs']['color']
in Text blocks (Paragraph and Heading) if a color is not specified to the block.Closes WOOPLUG-5034: Fix text color inheritance in Paragraph and Heading blocks (#59696).
Screenshots or screen recordings:
How to test the changes in this Pull Request:
Testing that has already taken place:
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment
Fix color inheritance in Paragraph and Heading blocks.