MCPcopy Create free account
hub / github.com/adobe/react-spectrum / onDrop

Function onDrop

packages/@react-spectrum/ai/src/PromptField.tsx:362–375  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

360 return acceptedAttachmentTypes && types.has(acceptedAttachmentTypes) ? 'copy' : 'cancel';
361 },
362 async onDrop(e) {
363 let files = await Promise.all(
364 e.items
365 .filter(isFileDropItem)
366 .filter(item => matchMimeType(item.type, acceptedAttachmentTypes!))
367 .map(async item => ({
368 id: crypto.randomUUID(),
369 file: await item.getFile(),
370 image: item.type.startsWith('image/') ? URL.createObjectURL(await item.getFile()) : ''
371 }))
372 );
373 onAddAttachments?.(files);
374 setAttachments(attachments => [...attachments, ...files]);
375 }
376 });
377
378 let [isListening, setListening] = useState(false);

Callers

nothing calls this directly

Calls 3

matchMimeTypeFunction · 0.85
getFileMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected