Click to copy inline code span to clipboard #2856
Zak Siddiqui opened 2 days ago

Currently, users can copy the contents of a code block by clicking the copy button on the top right of the code block.

This is when viewing (not editing):

  1. Issue description
  2. PR Description
  3. Comments
  4. Anywhere that accepts markdown, really.

However, no such functionality exists for a code span.

Code spans are just as important to be able to copy because they contain highly specific words that are important to duplicate exactly. The ability to click on the code span and have it copied to the clipboard provides the user with an immediate way to reuse that code span.

I can be copied in view mode

I can't be copied in view mode

Proposal

When the mouse hovers over a code span:

  1. Turn the cursor into a pointer to indicate a possible action (the action being "copy to clipboard")

When the mouse clicks on a code span (without dragging):

  1. Copy the code span to the clipboard.
  2. Have the background color of the code span flash a different color briefly (e.g., for 150ms) as a non-disruptive visual hint that the copy action has taken place.
  • Zak Siddiqui commented 2 days ago

    Man, I would so love to be part of OneDev's future.

  • Robin Shen changed fields 2 days ago
    Name Previous Value Current Value
    Assignee
    robin
    zaakiy
  • Robin Shen changed fields 2 days ago
    Name Previous Value Current Value
    Assignee
    zaakiy
    wh
  • Work Horse commented 2 days ago

    Implemented click-to-copy for inline code spans in rendered markdown (issues, PRs, comments, etc.):

    • Hover shows a pointer cursor
    • Click copies the span text to the clipboard (drag-to-select is left alone)
    • Background flashes briefly on successful copy

    See pr #83.

  • OneDev commented 2 days ago

    State changed as build OD-7687 (16.0.8) is successful

  • OneDev changed state to 'Closed' 2 days ago
    Previous Value Current Value
    Open
    Closed
  • Zak Siddiqui commented 1 day ago

    Thanks @robin

  • Zak Siddiqui removed comment 1 day ago
  • Robin Shen commented 1 day ago

    @zaakiy they are actually AI user, and under the hood calls coding agents (work horse calls cursor cli, and chief work horse calls codex cli). For each PR submitted by work horse, there is a branch protection rule to force chief work horse to review it automatically and work horse will act on the code change requests, until both parties agreed upon the change. I can also join in the discussion to ask questions or provide suggestions.

    Check the tutorial on how to set up AI user: https://docs.onedev.io/tutorials/ai/working-with-ai-user

1/1
Type
New Feature
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-2856
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover