feat(editor): add global style setter functions to EmailTheming#3122
Conversation
…ted functions to EmailTheming - setGlobalStyles: sets the global panel styles on the editor document - setCurrentTheme: sets the current email theme on the editor document - setGlobalCSSInjected: sets the global CSS string injected into the email <head> All three functions are exported from @react-email/editor/plugins for consumer use. Bumps version from 0.0.0-experimental.34 to 0.0.0-experimental.35. Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- This PR looks safe to merge; the only noted issue is a naming-convention mismatch for an initialism in
packages/editor/src/plugins/email-theming/extension.tsx. - Impact is low and mostly stylistic, but aligning the function name (e.g., camel-cased acronym) will improve consistency and readability.
- Pay close attention to
packages/editor/src/plugins/email-theming/extension.tsx- rename the initialism in the function to match convention.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/editor/src/plugins/email-theming/extension.tsx">
<violation number="1" location="packages/editor/src/plugins/email-theming/extension.tsx:215">
P2: Custom agent: **Initialisms and Acronyms Naming Conventions**
Rename the function to use camel-cased acronym (e.g., setGlobalCssInjected) to comply with the naming convention for initialisms.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Use camel-cased acronym per naming conventions. Co-authored-by: Gabriel Miranda <gabrielmfern@outlook.com>
Summary
Adds three new exported functions to the
EmailThemingmodule, allowing consumers of@react-email/editor/pluginsto programmatically update global styles, theme, and CSS injection on the editor document.New Functions
setGlobalStyles(editor, styles)— Sets the global panel styles on the editor document (persists under theGlobalContentnode's'styles'key).setCurrentTheme(editor, theme)— Sets the current email theme ('basic'or'minimal') on the editor document (persists under the'theme'key).setGlobalCssInjected(editor, css)— Sets the global CSS string that gets injected into the email<head>(persists under the'css'key).All three functions use the existing
editor.commands.setGlobalContent()command under the hood and are fully typed.Exports
The functions are exported from
@react-email/editor/pluginsthrough the existing barrel re-export chain:extension.tsx→email-theming/index.ts→plugins/index.ts→@react-email/editor/pluginsVersion Bump
Bumps
@react-email/editorfrom0.0.0-experimental.34→0.0.0-experimental.35for publishing after merge.Slack Thread
Summary by cubic
Expose three helpers in EmailTheming to set global styles, the current theme, and injected CSS on the editor document from
@react-email/editor/plugins. All functions calleditor.commands.setGlobalContent; signatures were tidied.New Features
setGlobalStyles(editor, styles)— set global panel styles.setCurrentTheme(editor, theme)— set the current email theme.setGlobalCssInjected(editor, css)— set CSS injected into the email head.Dependencies
@react-email/editorto0.0.0-experimental.35.Written for commit b069e5f. Summary will update on new commits.