Strip <img> tags from pasted HTML in TipTap editor#5897
Merged
marcellamaki merged 1 commit intoMay 12, 2026
Conversation
Pasted <img> tags survived into the editor doc and the saved markdown. Remote image references then blocked channel publish (learningequality#5895). Adds a single sync transformer (transformPastedHTML) wired into both native paste (via editorProps.transformPastedHTML) and the toolbar Paste button. Existing Word/Office sanitization is preserved and now applies to both paths — previously only the toolbar ran it. Fixes learningequality#5895
This was referenced May 12, 2026
marcellamaki
approved these changes
May 12, 2026
Member
marcellamaki
left a comment
There was a problem hiding this comment.
Was able to follow the reviewer guidance here as described. Approving for @pcenov 's further testing/confirmation tomorrow! 😅
Merged
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
Strips every
<img>tag from HTML pasted into the TipTap editor. Pastes from Google Docs, web pages, and other rich-text sources previously left remotehttps://...image references in the saved markdown, which blocked channel publish per #5895.The transformer also subsumes the existing Word/Office cleanup that previously only ran on the toolbar Paste button — native Ctrl-V paste now gets the same treatment.
Users who want an image in the editor continue to use the existing upload flow (toolbar, drag-and-drop, or paste-image-data), which routes through
imageProcessor.processFileand produces a checksum-backed image.References
Reviewer guidance
Reproducer (matches #5895):
Verified locally:
Also check:
<img>strip.mso-*styles,Mso*classes still dropped.imageHandler, not the paste path).AI usage
Used Claude (Opus 4.7) to brainstorm scope, write a spec and implementation plan, and drive the TDD implementation (27 unit tests, then implementation). I made scope decisions throughout (strip-only vs fetch+upload; refactor into the transformer pipeline), reviewed each diff before commit, and ran the manual paste/publish verification against the dev server.