diff --git a/apps/example/src/pages/CustomSlotsDemoPage.tsx b/apps/example/src/pages/CustomSlotsDemoPage.tsx index 7ff8a0ad..5c10d0c1 100644 --- a/apps/example/src/pages/CustomSlotsDemoPage.tsx +++ b/apps/example/src/pages/CustomSlotsDemoPage.tsx @@ -238,11 +238,22 @@ function OrbitComposer({ onAbort, onOpenFilePicker, onRemoveAttachment, + onAddFiles, }: ChatComposerSlotProps) { // ToolApproval is rendered independently by use-ai. Hide the composer while // an approval is pending to match the built-in interaction pattern. if (pendingApprovals.length > 0) return null; + // Files pasted into a replacement composer go through the chat's own file + // handling, so they end up on the message the panel sends. + const handlePaste = (event: React.ClipboardEvent) => { + if (!fileUploadEnabled || event.clipboardData.files.length === 0) return; + if (!event.clipboardData.types.includes('text/plain')) { + event.preventDefault(); + } + onAddFiles(event.clipboardData.files); + }; + return (