feat: Allow clicking inline code spans to copy to clipboard #83
Merged
Work Horse opened 2 months ago

Inline code spans in rendered markdown can be clicked to copy their text to the clipboard. Hover shows a pointer cursor; a successful copy briefly flashes the span background. Dragging to select text still works without triggering copy.

Fixes #2856

Commits were merged into target branch
  • Unknown commented 2 months ago

    The implementation satisfies the requested inline-code click-to-copy behavior, preserves drag selection, scopes the interaction away from fenced code blocks, and provides the requested success feedback. The patch is focused and I found no blocking correctness, security, or maintainability concerns.

  • Unknown approved 2 months ago
  • Robin Shen commented 2 months ago

    @wh Add a tippy tooltip (should be translatable) when hover mouse over it.

  • feat: Add tippy tooltip on hover for clickable inline code spans
    Use the existing translatable "Copy to clipboard" string so hover reveals the action.
    
    Co-authored-by: Cursor <[email protected]>
    2 months ago
  • Work Horse commented 2 months ago

    Added a tippy tooltip on hover for inline code spans, using the existing translatable "Copy to clipboard" string.

  • Unknown commented 2 months ago

    The tooltip follow-up uses the existing translated copy-to-clipboard text and integrates with the established page-level tippy setup. The click-to-copy behavior remains scoped to inline code, preserves drag selection, and cleans up clipboard resources on both success and failure. I found no blocking correctness, security, maintainability, or test-coverage concerns.

  • Unknown approved 2 months ago
  • Robin Shen commented 2 months ago

    The tooltip text should be "Click to copy"

  • Robin Shen commented 2 months ago
  • Work Horse commented 2 months ago

    Updated the hover tooltip text to the translatable string "Click to copy".

  • Unknown commented 2 months ago

    The inline-code click-to-copy behavior is correctly scoped away from fenced code blocks, preserves drag selection, provides success feedback, and now exposes the requested translatable “Click to copy” tooltip. I found no blocking correctness, security, maintainability, or test-coverage concerns.

  • Unknown approved 2 months ago
  • Unknown commented 2 months ago

    The final patch correctly scopes click-to-copy to inline code spans, preserves drag selection, provides translated hover guidance and success feedback, and cleans up clipboard resources on both success and failure. I found no blocking correctness, security, maintainability, or test-coverage concerns.

  • Unknown approved 2 months ago
  • Robin Shen merged 2 months ago (merge commit: 0d8a44e0 )
1/1
Submitter Work Horse
Target main
Source issue-2856-click-to-copy-code-span
Merge Strategy
Create Merge Commit
Watchers (1)
Reference
pr OD-83
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover