8356
Wx
www-xonecas-io / files
www-xonecas-io / tickets / 1029-let-s-add-click-to-copy-to-clipboard-to-the.md
1.9 KB
1--- 2id: 1029 3title: Let's add click to copy to clipboard to the clone link 4type: feature 5status: done 6priority: p2 7created: 2026-11-08T04:29:39Z 8updated: 2026-11-08T20:16:25Z 9source: devnote 10area: site 11moves: 2026-11-08T04:37:49Z inbox doing drag; 2026-11-08T04:42:15Z doing review agent; 2026-11-08T20:16:25Z review done drag 12--- 13 14## Context 15 16Filed from `http://192.168.122.10:8080/projects/macotron-plugin-caffeinate/`, on `pre.bg-pre.text-pre-fg.rounded-[2px]`. 17 18> git clone https://xonecas.io/macotron-plugin-caffeinate.git 19 20## Notes 21 22- 2026-11-08 04:34Z (agent): Triage: type feature (it was bug), priority p2, area site. No typos to fix. 23 24 The clone box is the <pre> in internal/site/templates/project.html (Clone section), 'git clone https://xonecas.io/<name>.git' since 1015. Today it only has select-all, so one click selects the text but copies nothing. Related: 1015. 25 26- 2026-11-08 04:42Z (agent): Done. Clicking the clone box on a project page copies 'git clone https://xonecas.io/<name>.git'. The Clone heading reads 'click to copy' and switches to 'copied' for 1.5 s. The box shows a pointer cursor and a 'Click to copy' tooltip. 27 28 The Clipboard API only exists on https or localhost. On plain http, such as http://192.168.122.10:8080, the click selects the text and copies it with execCommand('copy'). So it works both in development and once served over https. 29 30 Change: an inline script and the label in internal/site/templates/project.html. 31 32 CHECKED (agent-browser): on http://192.168.122.10:8080/projects/irvc/ (not a secure context, no Clipboard API), the click ran copy, which returned true, with 'git clone https://xonecas.io/irvc.git' selected, and the label read 'copied'. On http://localhost:8080 (secure), the click passed the same text to navigator.clipboard.writeText. go test passes. 33 34 NOT CHECKED: pasting from the real system clipboard. The headless browser has none I can read, so I stubbed the two copy calls to see what they were given.