fix(editor): email themiing's body background not in editor#3123
fix(editor): email themiing's body background not in editor#3123gabrielmfern merged 2 commits intofeat/ai-oss-editorfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
commit: |
There was a problem hiding this comment.
cubic analysis
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Linked issue analysis
Linked issue: PRODUCT-1696: Apply EmailTheming body background color to live editor view
| Status | Acceptance criteria | Notes |
|---|---|---|
| ✅ | Apply body background color to the live editor view (editor container) | Sets view.dom.style.backgroundColor from merged CSS |
| ✅ | Implement change inside the ProseMirror plugin's sync() function | Merged CSS read and style applied inside sync() when styles change |
| ✅ | Extract body.backgroundColor from merged CSS (getMergedCssJs) and use it | Reads mergedCssJs.body?.backgroundColor before applying |
| ✅ | Clean up the background color in the plugin's destroy() handler | Clears view.dom.style.backgroundColor in destroy() |
| ✅ | Reactive updates: background updates when theme/styles change | sync() updates on styles change and tests assert new color |
| ✅ | Do not set background when no backgroundColor is defined | Sets '' when bodyBg not a string; test asserts no background |
| ✅ | Add tests covering applying background, no background, reactive updates, and cleanup on destroy | Four tests added covering apply, none, reactive, and destroy cleanup |
| ✅ | Continue injecting merged theme CSS (injectThemeCss called with merged CSS) | injectThemeCss called with mergedCssJs and scope preserved |
| ✅ | Prefer applying background to editor container as suggested (alternative approach implemented) | Applied background directly to view.dom.style per suggested alt. |
The EmailTheming plugin now applies the body background color from the theme to the editor's DOM element (view.dom) in the ProseMirror plugin's sync() function. This ensures the live editing experience matches the serialized email output. Changes: - Extract body backgroundColor from merged CSS and apply it to view.dom.style.backgroundColor in the sync() function - Clean up the background color on plugin destroy - Add 4 tests covering: applying bg color, no bg when undefined, reactive updates on theme change, and cleanup on destroy Closes PRODUCT-1696 Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
8ab979e to
b967b14
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary
The
EmailThemingplugin applies body background color during serialization (viaBaseTemplate), but the same background color was not reflected in the live editor view. This caused a visual mismatch between the editing experience and the final email output.Raised in PR #3115 review.
Changes
sync()function, extract the bodybackgroundColorfrom the merged CSS and apply it directly toview.dom.style.backgroundColordestroy()handlerbackgroundColoris definedRelevant files
packages/editor/src/plugins/email-theming/extension.tsx— main implementationpackages/editor/src/plugins/email-theming/extension.spec.ts— new testsCloses PRODUCT-1696
Slack Thread
Summary by cubic
Fixes the mismatch between the live editor and the serialized email by applying the theme’s body background color to the editor container. Meets PRODUCT-1696.
backgroundColorfrom merged theme CSS and set it onview.domin sync.@react-email/editorto 0.0.0-experimental.37.Written for commit 1f56b25. Summary will update on new commits.