Question: is there a quick way to copy a description or a comment? #2970
Zak Siddiqui opened 2 days ago

Question

Is there a quick way to copy a description or a comment?

Motivation

The ability to quickly copy a description or a comment to the clipboard enables easy sharing of content.

Preserving the markdown would also preserve the original intended meaningfulness of the text when sharing it.

Possible solution

This could be achieved by either adding a Copy button to the same row that contains the Quote link.

Alternatively, and this would be much more advanced, would be to enable the user to highlight the section of the description or the markdown that needs to be copied. Instead of copying plain text, it copies the actual markdown of formatted text.

  • Service Desk commented 2 days ago

    There is currently no dedicated Copy action for an issue/PR description or comment that puts the original Markdown on the clipboard.

    What exists today:

    • Quote (next to Edit/Delete on comments) inserts the full comment Markdown into the reply editor as a blockquote. From there you can select and copy it, then discard the reply if you only needed the text.
    • If you can Edit the description/comment, opening the editor shows the raw Markdown so you can select-all and copy.
    • Selecting rendered text and using the browser copy shortcut copies plain/rendered text, not Markdown.
    • Fenced code blocks have a copy control, and clicking an inline code span copies that snippet.

    So there is no one-click “copy description/comment as Markdown” yet, and selecting formatted text does not recover the underlying Markdown. A Copy control beside Quote (or similar) would be a new feature; please say if you want this tracked as an enhancement.

  • Zak Siddiqui commented 2 days ago

    I'm worried about the extra weight of client code if we try to enhance it. It's imperative to keep OneDev highly performant.

    Ideally, we would not want to weigh down the server by having to compute exactly which of the text is bounded and then retrieve it as markdown, because we do not want to increase the compute cost of the OneDev SaaS Server.

    Furthermore, we would not want to increase the client-side footprint for a feature that many would say is frivolous and unnecessary.

    Consider the best balance of how this can be implemented whilst minimizing compute on the server and minimizing client-side code weight.

  • Service Desk commented 2 days ago

    Agreed — any Copy enhancement should stay tiny.

    Balanced approach (if we add anything at all): a whole-description / whole-comment Copy next to Quote.

    Why that stays cheap:

    • Description and comment bodies are already stored and loaded as Markdown when the page is rendered. There is no need for the server to figure out which rendered text is “bounded” and convert it back to Markdown, and no extra compute cost on click beyond reading a field that is already in memory.
    • OneDev already has a small clipboard helper (CopyToClipboardLink). Reusing that pattern means the client cost is essentially one extra control and a short copy script — not a new feature stack.
    • Quote already uses the same stored Markdown; Copy would be the same data with a simpler client action (clipboard instead of inserting a blockquote into the reply editor).

    What we should not pursue: selection-aware “copy the Markdown behind highlighted rendered text.” That needs either heavy client mapping from DOM selection to source Markdown, or server-side reverse conversion — both conflict with keeping SaaS compute and client footprint low for a convenience feature.

    Practical takeaway: keep using Quote or Edit when you need Markdown today. If a dedicated Copy is still worth tracking later, scope it strictly to full-body copy via the existing clipboard helper.

    Does that address the concern, or would you still like the lightweight full-body Copy filed as an enhancement?

  • Zak Siddiqui commented 2 days ago

    LGTM

    Please create draft issue text as a comment in this issue.

  • Service Desk commented 2 days ago

    Question answered; draft enhancement text posted above for filing when desired.

  • Service Desk commented 2 days ago

    Draft for a follow-up enhancement issue:

    Title: Add lightweight Copy action for issue/PR description and comments

    Type: Improvement
    Priority: Minor

    Description:

    Summary

    Add a Copy control next to Quote (or equivalent) that copies the full issue/PR description or comment Markdown to the clipboard.

    Motivation

    Users sometimes want to share a description or comment while preserving Markdown. Today they must use Quote (into a reply editor) or Edit (when permitted) to reach the raw Markdown. A dedicated Copy action would make that one click.

    Scope

    • Full description / full comment body only
    • Copy the already-loaded Markdown source (same data Quote uses)
    • Reuse the existing CopyToClipboardLink pattern
    • Place the control beside Quote on comments, and in a comparable place for the description

    Out of scope

    • Selection-aware “copy Markdown behind highlighted rendered text”
    • Any server-side reverse conversion from rendered HTML to Markdown
    • New client libraries or significant client footprint growth

    Constraints

    Keep server compute and client code weight minimal: no extra request on click beyond reading Markdown already present for the page; no new feature stack.

    Related discussion: issue #2970

  • Service Desk changed state to 'Closed' 2 days ago
    Previous Value Current Value
    Open
    Closed
1/1
Type
Question
Priority
Minor
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
OD-2970
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover