Fix Photos Add, Remove, and Replace against the library picker.

Remove clears the Photos array and backing image fields; Add opens the picker with disk upload and drops empty drafts on cancel.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-26 17:06:39 -05:00
co-authored by Cursor
parent 50319e03a9
commit e06afe4a17
4 changed files with 121 additions and 41 deletions
+9 -2
View File
@@ -4,12 +4,14 @@
type="button"
class="slot-thumb"
:class="asset ? 'slot-thumb--slot' : 'slot-thumb--empty'"
:aria-label="asset ? 'Replace photo' : 'Select photo'"
:aria-label="asset ? 'Replace photo' : 'Choose a photo'"
@click="$emit('pick')"
>
<span v-if="asset && hidden" class="p-2 text-center text-[var(--type-sm)] text-[var(--muted)]">Still loaded · preview hidden</span>
<img v-else-if="asset" :src="thumbSrc" alt="">
<span v-else class="inline-flex items-center gap-1">Select <span aria-hidden="true">▾</span></span>
<span v-else class="inline-flex flex-col items-center gap-1 px-2 text-center">
<span>Choose a photo</span>
</span>
</button>
<div class="photo-card-body">
<label class="photo-role-label">
@@ -31,6 +33,11 @@
title="Mention this photo in the prompt"
@click.stop="$emit('mention')"
>Mention in prompt</button>
<button
v-if="!readonly && asset"
type="button"
@click.stop="$emit('pick')"
>Replace</button>
<button v-if="!readonly" type="button" @click.stop="$emit('remove')">Remove</button>
</div>
</div>