Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview/pages: revert copy-to-clipboard button for now

this is a temporary change to remove the copy-to-clipboard button in
readmes and blob views. to reintroduce this:

- understand if we need this at all (you can view raw, ctrl+a, ctrl+c)
- dedup code with existing copy-to-clipboard buttons
- figure out a good design for this in blob views, it is a bit cluttered
at the moment

Signed-off-by: oppiliappan <me@oppi.li>

author
oppiliappan
date (Jun 11, 2026, 11:29 AM +0300) commit d7f83989 parent 1591ed85 change-id xqutpkuw
+1 -56
-6
appview/pages/templates/repo/blob.html
··· 48 48 <a href="/{{ .RepoInfo.FullName }}/raw/{{ pathEscape .Ref }}/{{ .Path }}">View raw</a> 49 49 {{ end }} 50 50 51 - {{ if (or .BlobView.ContentType.HasTextView .BlobView.ContentType.IsImage) }} 52 - <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 53 - {{ template "repo/fragments/copyFileButton" (dict "Url" (printf "/%s/raw/%s/%s" .RepoInfo.FullName (pathEscape .Ref) .Path)) }} 54 - {{ end }} 55 - 56 51 {{ if (and .BlobView.ContentType.HasTextView .BlobView.ContentType.HasRenderedView) }} 57 52 <span class="select-none px-1 md:px-2 [&:before]:content-['·']"></span> 58 53 <a href="/{{ .RepoInfo.FullName }}/blob/{{ pathEscape .Ref }}/{{ .Path }}?code={{ .ShowRendered }}" hx-boost="true"> ··· 130 125 </p> 131 126 {{ end }} 132 127 {{ template "fragments/multiline-select" }} 133 - {{ template "repo/fragments/copyFileScript" }} 134 128 <script> 135 129 (() => { 136 130 const abortController = new AbortController();
-9
appview/pages/templates/repo/fragments/copyFileButton.html
··· 1 - {{ define "repo/fragments/copyFileButton" }} 2 - <button type="button" 3 - class="btn-flat gap-1.5" 4 - onclick="copyRawFile(this, '{{ .Url }}')"> 5 - <span class="copy-check hidden">{{ i "check" "size-3.5" }}</span> 6 - <span class="copy-label">copy to clipboard</span> 7 - <span class="copy-spinner hidden">{{ i "loader-circle" "size-3.5 animate-spin" }}</span> 8 - </button> 9 - {{ end }}
-38
appview/pages/templates/repo/fragments/copyFileScript.html
··· 1 - {{ define "repo/fragments/copyFileScript" }} 2 - <script> 3 - async function copyRawFile(btn, url) { 4 - const label = btn.querySelector('.copy-label'); 5 - const spinner = btn.querySelector('.copy-spinner'); 6 - label.textContent = 'copying'; 7 - spinner.classList.remove('hidden'); 8 - btn.disabled = true; 9 - try { 10 - const res = await fetch(url); 11 - if (!res.ok) throw new Error(); 12 - const contentType = res.headers.get('Content-Type') || ''; 13 - if (contentType.startsWith('image/')) { 14 - const blob = await res.blob(); 15 - await navigator.clipboard.write([ 16 - new ClipboardItem({ [contentType]: blob }) 17 - ]); 18 - } else { 19 - const text = await res.text(); 20 - await navigator.clipboard.writeText(text); 21 - } 22 - spinner.classList.add('hidden'); 23 - label.textContent = 'copied'; 24 - btn.querySelector('.copy-check').classList.remove('hidden'); 25 - btn.disabled = false; 26 - setTimeout(() => { 27 - label.textContent = 'copy to clipboard'; 28 - btn.querySelector('.copy-check').classList.add('hidden'); 29 - }, 2500); 30 - } catch { 31 - spinner.classList.add('hidden'); 32 - label.textContent = 'error'; 33 - btn.disabled = false; 34 - setTimeout(() => { label.textContent = 'copy to clipboard'; }, 2500); 35 - } 36 - } 37 - </script> 38 - {{ end }}
+1 -3
appview/pages/templates/repo/fragments/readme.html
··· 1 1 {{ define "repo/fragments/readme" }} 2 2 <div class="mt-4 rounded bg-white dark:bg-gray-800 drop-shadow-sm w-full mx-auto overflow-hidden"> 3 3 {{- if .ReadmeFileName -}} 4 - <div class="px-4 py-2 border-b border-gray-200 dark:border-gray-600 flex justify-between"> 4 + <div class="px-4 py-2 border-b border-gray-200 dark:border-gray-600"> 5 5 <span class="flex items-center gap-2"> 6 6 {{ i "file-text" "w-4 h-4" "text-gray-600 dark:text-gray-400" }} 7 7 <span class="font-mono text-sm text-gray-800 dark:text-gray-200">{{ .ReadmeFileName }}</span> 8 8 </span> 9 - {{ template "repo/fragments/copyFileButton" (dict "Url" (printf "/%s/raw/%s/%s" .RepoInfo.FullName (pathEscape .Ref) .ReadmeFileName)) }} 10 9 </div> 11 10 {{- end -}} 12 11 <section ··· 24 23 {{- end -}}</article> 25 24 </section> 26 25 </div> 27 - {{ template "repo/fragments/copyFileScript" }} 28 26 {{ end }}