Skip to content

Restore Copy Link in chat link context menu#4161

Merged
juliusmarminge merged 7 commits into
pingdotgg:mainfrom
caezium:agent/copy-chat-link
Jul 22, 2026
Merged

Restore Copy Link in chat link context menu#4161
juliusmarminge merged 7 commits into
pingdotgg:mainfrom
caezium:agent/copy-chat-link

Conversation

@caezium

@caezium caezium commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What Changed

  • Added Copy Link to the native context menu for HTTP(S) links in chat messages.
  • Reused the existing clipboard helper and markdown action error reporting.
  • Preserved the existing integrated-browser and system-browser actions.
  • Left fragment and non-HTTP links on the normal browser context-menu path.
  • Added focused tests for menu selection, cancellation, URL classification, and failures.

Why

The renderer-owned chat link menu replaced Electron's native link menu but omitted its copy action, so there was no way to copy a link without opening it.

Fixes #4155.

UI Changes

Before

Before: link context menu without Copy Link

After

After: link context menu with Copy Link

Interaction

Watch the six-second interaction video

The screenshots and video were captured from an actual authenticated T3 Code Dev build using an isolated test home and neutral example.com content.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Low Risk
Localized chat UI refactor with injected clipboard/shell APIs and tests; no auth or data-layer changes.

Overview
Restores Copy Link on right-click for HTTP(S) links in chat markdown by moving the custom context menu into externalLinkContextMenu.ts and wiring Copy Link through writeTextToClipboard.

The menu still offers open in integrated browser and open in system browser; failures keep the existing markdown action reporting with per-action operation names (including copy-link). The custom menu only intercepts context menu for valid web URLs (resolveExternalWebLinkHost); fragment and non-HTTP links fall through to the default browser menu again.

Adds unit tests for menu items, each action, cancellation, host resolution, and error paths.

Reviewed by Cursor Bugbot for commit 6f56bf5. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Restore Copy Link option in chat external link context menu

  • Extracts context menu logic into a new externalLinkContextMenu.ts module exporting showExternalLinkContextMenu and resolveExternalWebLinkHost.
  • The context menu now includes three items: open in preview, open externally, and copy link, with the copy action writing to clipboard via writeTextToClipboard.
  • Failures for each action are reported with specific operation identifiers (show-link-context-menu, open-link-in-preview, etc.).
  • The menu is only shown for valid http/https links; non-web and same-document links no longer trigger it.

Macroscope summarized 6f56bf5.

@caezium
caezium marked this pull request as ready for review July 19, 2026 18:09
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

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

Run ID: d6fb5e60-4555-4fe5-9bb1-fef5c4c9baeb

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 19, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 19, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR adds a "Copy Link" option to the external link context menu by extracting the menu logic into a new testable module. The change is self-contained, includes comprehensive unit tests, and the author has recent commits to this code area.

You can customize Macroscope's approvability policy. Learn more.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1f0312f. Configure here.

Comment thread apps/web/src/components/chat/externalLinkContextMenu.ts
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 20, 2026 21:21

Dismissing prior approval to re-evaluate 2cf6538

@caezium
caezium force-pushed the agent/copy-chat-link branch from 2cf6538 to d7370cb Compare July 20, 2026 21:25
@juliusmarminge

Copy link
Copy Markdown
Member

please enable maintainer edits or cherry pick 8f19cb6a onto this branch

@caezium

caezium commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@juliusmarminge enabled

@juliusmarminge
juliusmarminge merged commit e5fba26 into pingdotgg:main Jul 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy Link is missing from the chat link context menu

2 participants