fix: keep image attachment add button visible

This commit is contained in:
134 2026-07-09 14:39:38 +08:00
parent c9ed662809
commit 72b1f8f1cf

View File

@ -15265,33 +15265,41 @@ export function CanvasChatPanel({
</div> </div>
) : null} ) : null}
{!isWorkspacePresentation && !isDetailGenerationMode && !isVideoWorkspace && activeComposerMode === "image" ? ( {!isWorkspacePresentation && !isDetailGenerationMode && !isVideoWorkspace && activeComposerMode === "image" ? (
<button <div className="mx-4 mt-3 flex gap-2 overflow-x-auto pb-1 scrollbar-hide">
type="button" {attachments.map((attachment, index) => (
className="mx-4 mt-3 flex h-16 w-16 shrink-0 flex-col items-center justify-center gap-1.5 overflow-hidden rounded-[18px] bg-[#f3f3f4] text-[#a8adb5] transition-colors hover:bg-[#ececee] hover:text-[#7d848e] dark:bg-white/8 dark:text-zinc-400 dark:hover:bg-white/12" <div
onClick={() => fileInputRef.current?.click()} key={`${attachment.url}-${index}`}
disabled={isSubmitting} className="relative h-16 w-16 shrink-0 overflow-hidden rounded-[18px] bg-[#f3f3f4] dark:bg-white/8"
title="添加参考图" title={attachment.name || `参考图 ${index + 1}`}
> >
{attachments[0]?.url ? ( <img
<img src={buildPreviewImageUrl(attachment.url, 180)}
src={buildPreviewImageUrl(attachments[0].url, 180)} alt={attachment.name || `参考图 ${index + 1}`}
alt={attachments[0].name || "参考图"} className="h-full w-full object-cover"
className="h-full w-full object-cover" loading="lazy"
loading="lazy" decoding="async"
decoding="async" onError={(event) => {
onError={(event) => { if (event.currentTarget.src !== attachment.url) {
if (event.currentTarget.src !== attachments[0]?.url) { event.currentTarget.src = attachment.url;
event.currentTarget.src = attachments[0]?.url || ""; }
} }}
}} />
/> </div>
) : ( ))}
<> <button
<ImagePlus className="h-5 w-5" /> type="button"
<span className="text-[13px] font-medium leading-none">参考图</span> className="flex h-16 w-16 shrink-0 flex-col items-center justify-center gap-1.5 rounded-[18px] border border-dashed border-[#d9dde4] bg-[#f3f3f4] text-[#a8adb5] transition-colors hover:border-[#c6ccd6] hover:bg-[#ececee] hover:text-[#7d848e] disabled:cursor-not-allowed disabled:opacity-60 dark:border-white/12 dark:bg-white/8 dark:text-zinc-400 dark:hover:border-white/20 dark:hover:bg-white/12"
</> onClick={() => fileInputRef.current?.click()}
)} disabled={isSubmitting}
</button> title="继续添加参考图"
aria-label="继续添加参考图"
>
<ImagePlus className="h-5 w-5" />
<span className="text-[13px] font-medium leading-none">
参考图
</span>
</button>
</div>
) : null} ) : null}
{isClawdMode && clawdTableFiles.length > 0 ? ( {isClawdMode && clawdTableFiles.length > 0 ? (
<div className="mx-4 mt-3 flex flex-wrap gap-2"> <div className="mx-4 mt-3 flex flex-wrap gap-2">