Copy a clip prompt to the clipboard from the info button.

Keep the hover preview, and confirm with a toast after a successful copy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-25 23:16:10 -05:00
co-authored by Cursor
parent a47e714212
commit 22d99f18db
+17 -1
View File
@@ -478,7 +478,9 @@
<button <button
type="button" type="button"
class="flex h-6 w-6 items-center justify-center rounded-full text-zinc-500 hover:text-amber-200" class="flex h-6 w-6 items-center justify-center rounded-full text-zinc-500 hover:text-amber-200"
:aria-label="'Prompt for ' + (item.name || 'clip')" :aria-label="'Copy prompt for ' + (item.name || 'clip')"
title="Copy prompt"
@click.stop="copyPrompt(item.prompt)"
> >
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="h-4 w-4">
<circle cx="12" cy="12" r="10" /> <circle cx="12" cy="12" r="10" />
@@ -993,6 +995,20 @@ function toast(message: string) {
}, 7000) }, 7000)
} }
async function copyPrompt(text: string) {
const promptText = (text || '').trim()
if (!promptText) {
toast('This clip has no prompt to copy')
return
}
try {
await navigator.clipboard.writeText(promptText)
toast('Prompt copied')
} catch {
toast('Could not copy the prompt')
}
}
function resetImage() { function resetImage() {
file.value = null file.value = null
preview.value = '' preview.value = ''