-
@servicedesk please create an implementation plan based on the above, including suggested code changes
-
@zaakiy Implementation plan for the lightweight Copy action:
Approach
Add a full-body Copy control in the shared comment viewer (
CommentPanel), next to Quote. Issue/PR descriptions and comments all render through that panel, so one change covers the stated scope without touching each caller separately.Existing callers that get Copy automatically:
- Issue description —
IssuePrimaryPanel - Issue comments —
IssueCommentPanel - PR description —
PullRequestDetailPage - PR comments —
PullRequestCommentPanel
This reuses
CopyToClipboardLink/ ClipboardJS (same pattern as AI chat “Copy as Markdown”). Markdown is already available when the viewer is built (getComment(), same source Quote uses), so click does not need a new server round-trip or HTML→Markdown conversion.Suggested code changes
-
CommentPanel.html(viewFragaction row)
Insert a Copy control beside Quote, matching the existing text-link style (Edit/Quote/Delete), e.g. after Quote and before Delete:<wicket:enclosure child="copy"> <span class="d-first-child-none dot mr-2"></span> <a wicket:id="copy" class="text-muted text-hover-primary mr-2"><wicket:t>Copy</wicket:t></a> </wicket:enclosure>Text label (not icon-only) keeps the row consistent; tippy can still show copy/copied feedback.
-
CommentPanel.java(newViewer())
Add aCopyToClipboardLinkwith anIModelthat returnsgetComment(), e.g. tooltip_T("Copy Markdown")/ default “Copied to clipboard”.
Visibility: show when content is non-blank (StringUtils.isNotBlank(getComment())). Unlike Quote, do not require a signed-in user — copy only needs view access.
Optional:isCopyEnabled()defaulting totrueif a caller ever needs to hide it (mirrorsisQuoteEnabled()). -
No new JS / libraries
copy-to-clipboard.jsalready supports links without an SVG (icon swap is skipped; tippy still updates). Do not add selection mapping or reverse Markdown conversion. -
Translations
Use<wicket:t>Copy</wicket:t>and_T(...)for the tooltip. Do not hand-edit generatedTranslation_*.javafiles. -
Out of scope for this change
- Code review comments (
CodeCommentPanelhas its own Quote row; can be a follow-up if desired) - Selection-aware copy
- Any extra Ajax on click
- Code review comments (
Why this stays lightweight
- Server: no new endpoint or compute on click; text is taken from the already-loaded entity field at render.
- Client: one extra anchor + existing ClipboardJS helper; no new dependency.
- Scope: full body only, same data Quote already uses.
Manual test plan
- Issue with description: Copy puts full Markdown on clipboard; empty description hides Copy.
- Issue comment: same; works when logged out if the comment is visible.
- PR description and PR comment: same.
- After Edit/Save, Copy reflects the updated Markdown.
- Quote / Edit / Delete behavior unchanged.
Does this plan look good to proceed?
- Issue description —
-
LGTM
-
-
Name Previous Value Current Value Assignee
robin
wh
-
-
Implemented the approved plan: added a Copy control next to Quote in
CommentPanel, reusingCopyToClipboardLinkwith the already-loaded Markdown. It covers issue/PR descriptions and comments, is shown when content is non-blank (no login required), and can be hidden viaisCopyEnabled().See also pr #110
| Type |
Improvement
|
| Priority |
Minor
|
| Assignee | |
| Labels |
No labels
|
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
CopyToClipboardLinkpatternOut of scope
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