Repository navigation
fix(editors): keep links and emoji in rich text code blocks - #238
Merged
Merged
Conversation
The WYSIWYG keeps only a code block's plain text, but detectLossy passed links, emoji and styled text inside a rich_text_preformatted, so the next edit silently deleted them. A code block holding anything but plain text now opens in the structured editor instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MTy6g5wxP9DqjWJQshGz51
Contributor
Cloudflare preview✅ Deployed |
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
block-kitchen | 2f8560f | Commit Preview URL Branch Preview URL |
Oct 12 2026, 02:01 PM |
StephenTangCook
pushed a commit
that referenced
this pull request
Oct 12, 2026
Generalize the mention-in-code-block check to every non-text inline and styled text run, matching #238, so the two changes merge cleanly in either order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MTy6g5wxP9DqjWJQshGz51
6 tasks done
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
A rich text code block (
rich_text_preformatted) holding anything but plain text now opens in the structured editor. Before, the WYSIWYG opened it and the next edit silently deleted its links, emoji and styled text.Why
The WYSIWYG's code block holds plain text only.
blockElementToPMkeeps just thetextruns. ButdetectLossychecked a code block's inlines with the same rules as a paragraph, which allowlinkandemojiand the bold/italic/strike/underline/code styles. So it reported the block as safe to round-trip:detectLossynow flags each non-text inline in a code block (In code block: link) and each styled text run (Styled text in code block). Plain-text code blocks, the WYSIWYG's own output, still edit in the WYSIWYG. A code block's inlines are reported once, so an unsupported inline there (say, a channel mention) isn't also listed asInline: channel.Test plan
pnpm typecheckpnpm lintpnpm test: 647 tests pass (522 unit, 125 Storybook browser), run project by project against a pre-provisioned Chromium (BK_CHROMIUM_EXECUTABLE).test/rich-text-tiptap-code-block.test.ts:RichTextEditoropens a code block holding a link in structured mode.main.Notes for reviewer
#237 (the
@mention picker) needs to flag a mention in a code block too. I'm updating it to carry this samedetectLossyhunk, so the two PRs merge cleanly in either order.🤖 Generated with Claude Code
https://claude.ai/code/session_01MTy6g5wxP9DqjWJQshGz51
Generated by Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.