fix(web): stop wrapping partial code block selections in markdown fences
What Changed
- In
chatMarkdownClipboardPayload, returnrange.toString()when the selection is inside a<pre>instead of running it through the markdown serializer.
Why
Partial code block selections were wrapped in fences and a language tag. Should copy as plain text.
Closes #4741.
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] No UI changes
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
88f077d6-9e68-4f57-a53f-7b20ab3f6ddaYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved e29bd7a
Straightforward bug fix that adds a special case for copying partial code block selections. The change is self-contained, uses simple DOM traversal to detect when a selection is within a <pre> element, and bypasses markdown serialization in that case to preserve plain text.
You can customize Macroscope's approvability policy. Learn more.