feat(web): HTML normalization#630
Merged
Merged
Conversation
cfdc0da to
bd0bdef
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a web-side HTML normalization pipeline for pasted/inserted HTML so TipTap receives canonical enriched HTML (mirroring the existing native Gumbo-based normalizer), and wires it behind the useHtmlNormalizer flag.
Changes:
- Implemented
src/web/htmlNormalizer.ts(DOM-based HTML normalizer mirroring native behavior) and hooked it into the web TipTap input pipeline. - Added a Jest “web” project (jsdom environment) and a web test suite ported from the native C++ normalizer tests.
- Updated docs and the example web app to expose/enable
useHtmlNormalizer.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Adds jsdom/jest-environment-jsdom related dependency graph for web tests (currently pulls Jest 30 internals). |
| package.json | Adds jsdom test dependencies and splits Jest config into native + web projects. |
| src/web/tiptapHtmlNormalizer.ts | Adds optional call into the new normalizer before existing checkbox/ handling. |
| src/web/htmlNormalizer.ts | New DOMParser-based HTML normalizer implementation for web. |
| src/web/EnrichedTextInput.tsx | Enables normalization on paste via transformPastedHTML and for defaultValue/setValue. |
| src/web/tests/htmlNormalizer.test.ts | New Jest tests ported from native GumboParser tests. |
| docs/WEB.md | Documents that useHtmlNormalizer is supported on web. |
| docs/INPUT_API_REFERENCE.md | Updates platform matrix for useHtmlNormalizer to include Web. |
| apps/example-web/src/App.tsx | Enables useHtmlNormalizer in the web example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/web/normalization/tiptapHtmlNormalizer.ts:13
prepareHtmlForTiptapappliesnormalizeHtml()to all incoming HTML whenuseHtmlNormalizeris truthy. On native, the HTML normalizer is only intended for external HTML; internal enriched HTML (the library’s own<html>…</html>format) is parsed directly and only falls back to normalization on parse failure. Normalizing internal HTML here will drop non-canonical attributes (e.g.<mention … type="user">…</mention>), which can break existing behavior/tests that rely on those attributes being preserved when setting content programmatically.
kacperzolkiewski
approved these changes
Jun 15, 2026
kacperzolkiewski
left a comment
Collaborator
There was a problem hiding this comment.
Overall solid, and works fine!
exploIF
approved these changes
Jun 18, 2026
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
Web implementation was missing the HTML normalizer
Test Plan
Try pasting styled text from
Google Docs,MS Wordor any other platformCompatibility
Checklist