t3code icon indicating copy to clipboard operation
t3code copied to clipboard

fix(web): stop wrapping partial code block selections in markdown fences

Open JoeJoeflyn opened this issue 4 months ago • 2 comments

What Changed

  • In chatMarkdownClipboardPayload, return range.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

JoeJoeflyn avatar Jul 31 '26 03:07 JoeJoeflyn

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 88f077d6-9e68-4f57-a53f-7b20ab3f6dda

You can disable this status message by setting the reviews.review_status to false in 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar Jul 31 '26 03:07 coderabbitai[bot]

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.

macroscopeapp[bot] avatar Jul 31 '26 04:07 macroscopeapp[bot]