reflex icon indicating copy to clipboard operation
reflex copied to clipboard

CTRL+V files from clipboard into rx.upload

Open Anga205 opened this issue 11 months ago β€’ 3 comments

i was wondering if its possible for a new feature to be added to rx.upload wherein if a user has a file (like a screenshot) stored in their clipboard, they can press ctrl+v onto a rx.upload component and it recieves/uploads the file to the website, it would look something like this: Screencast from 2024-03-07 11-53-14.webm

Anga205 avatar Mar 07 '24 06:03 Anga205

Seems like a cool feature, we don't have it in the internal roadmap currently but we would accept an outside contribution for this.

picklelo avatar Mar 12 '24 00:03 picklelo

I would like to work on this, could you maybe help me get started here ? I understand that I need to somehow use the blob that's in the clipboard and use it as an upload ?

SwarajBaral avatar Mar 28 '24 12:03 SwarajBaral

@SwarajBaral I'm not too sure what the approach is here actually, I'm guessing we need to have some sort of listener on the upload component for ctrl+v on which we trigger the clipboard upload. But I'm not sure how that listener would hook up. If we can trigger an action on the ctrl+v then we can probably run some JS to add to the upload.

We use react-dropzone under the hood for upload, looks like someone has found a way to do this on this issue that we can use for inspiration: https://github.com/react-dropzone/react-dropzone/issues/1210

picklelo avatar Mar 29 '24 02:03 picklelo