Repository navigation
fix(email-editor): ship the editor's own stylesheet for Tailwind apps - #194
Merged
Merged
Conversation
Since 0.3.0 the editor is styled by plain CSS (editor.css) that a Tailwind @source scan can't produce, and styles.css also carries a full Tailwind build, base reset and :root theme variables that restyle the host app. Copy editor.css into dist and export it as @sendlit/email-editor/editor.css, and say in the README which to load.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since 0.3.0,
@sendlit/email-editorgets almost all of its look from a plain stylesheet,src/editor.css(about 2,000 lines of.sle-*rules). Apps that already use Tailwind can't get those rules the way the README describes:@sourcescan only builds utility classes. It can't produce plain CSS, so with just@sourcethe editor renders unstyled.styles.css, bundleseditor.csswith a full Tailwind 3 build. That build includes Tailwind's base reset, its utility classes and:roottheme variables (--background,--primary,--border, …). Loading it in a Tailwind app overrides that app's own theme and resets everywhere, not just in the editor.Found while upgrading CourseLit's admin, which uses Tailwind 4, to email-blocks 0.5.1 and email-editor 0.3.0. The editor showed up unstyled.
Fix
src/editor.csstodist/editor.css(atsuponSuccessstep).@sendlit/email-editor/editor.css. Its rules are scoped to the editor (.sle, with its own--sle-*variables), so it's safe to load next to the host app's styles.styles.cssfor apps without Tailwind;@sourcepluseditor.cssfor apps with it.@sendlit/email-editoris included.Checks
email-editor: typecheck, build and tests (99/99) pass.dist/editor.cssis byte-identical tosrc/editor.css.import "@sendlit/email-editor/editor.css"in the admin layout, the editor renders fully styled (Write/Style switch, checklist, block handles, canvas). The rest of the admin's styling is unchanged.