diff --git a/ui/src/components/CommentThread.tsx b/ui/src/components/CommentThread.tsx index 151e1064..eda28518 100644 --- a/ui/src/components/CommentThread.tsx +++ b/ui/src/components/CommentThread.tsx @@ -377,10 +377,17 @@ export function CommentThread({ async function handleAttachFile(evt: ChangeEvent) { const file = evt.target.files?.[0]; - if (!file || !onAttachImage) return; + if (!file) return; setAttaching(true); try { - await onAttachImage(file); + if (imageUploadHandler) { + const url = await imageUploadHandler(file); + const safeName = file.name.replace(/[[\]]/g, "\\$&"); + const markdown = `![${safeName}](${url})`; + setBody((prev) => prev ? `${prev}\n\n${markdown}` : markdown); + } else if (onAttachImage) { + await onAttachImage(file); + } } finally { setAttaching(false); if (attachInputRef.current) attachInputRef.current.value = ""; @@ -415,7 +422,7 @@ export function CommentThread({ contentClassName="min-h-[60px] text-sm" />
- {onAttachImage && ( + {(imageUploadHandler || onAttachImage) && (