feat(web): custom style#653
Open
kacperzolkiewski wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds web support for applying/serializing custom foreground/background colors via a new TipTap mark, updates state reporting so toolbar/UI can reflect active colors, and extends the example web app + Playwright coverage to exercise the new behavior.
Changes:
- Introduces
customStyleTipTap mark forforegroundColor/backgroundColorand wires it into the web editor instance. - Updates web HTML normalization to preserve
color/background-colorspans and updatesonChangeStatehashing/state to include custom colors. - Adds example-web toolbar color pickers and new Playwright e2e + visual/round-trip tests.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/web/useOnChangeState.ts |
Reads customStyle mark attributes into state and includes them in the state hash to trigger updates. |
src/web/normalization/htmlNormalizer.ts |
Preserves color / background-color on <span> while still converting other CSS styles to inline tags. |
src/web/formats/EnrichedCustomStyle.ts |
New TipTap mark implementing custom foreground/background color styling + commands. |
src/web/EnrichedTextInput.tsx |
Registers the new mark and implements the imperative setStyle API on web using the mark commands. |
apps/example-web/src/components/Toolbar.tsx |
Adds UI controls for selecting/clearing text/background colors. |
apps/example-web/src/components/Toolbar.css |
Styles the new color picker UI. |
.playwright/tests/customStyleColors.spec.ts |
Adds e2e coverage for round-trip serialization, toolbar interaction, and a visual regression snapshot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Add custom style for foreground and background colors handling
Test Plan
Screenshots / Videos
Screen.Recording.2026-06-22.at.15.58.38.mov
Compatibility
Checklist