-
Notifications
You must be signed in to change notification settings - Fork 955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added event handler for paste #3078
base: main
Are you sure you want to change the base?
Added event handler for paste #3078
Conversation
I'm confused at the definition of the event signature, shouldn't we expect to receive the pasted content in the function ? Also can you provide a small example where this new trigger work ? |
Sure Will do today |
Example on how to use the on paste event
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i was reading back through the original ticket and i think 2 requested items are missing in this implementation:
- the handler isn't "global", as in, the element in question has to be focused in order to receive the paste event
- the handler cannot receive images, which was one of the example use cases
I don't know if i have any recommendations from the top of my head for how to best handle these issues though. For global event handling, i think we would need to register an event handler on document
, similar to the global hot key monitor example in the docs https://reflex.dev/docs/api-reference/browser-javascript/#using-react-hooks
As for handling other data types, i think this would need to be specified somewhere for the event handler to pick it up in the mapping var.
Maybe instead of adding on_paste
as a common event trigger, it might make sense to have an Clipboard
component that uses a hook to register the paste
event handler on document
and then it would have an on_paste
trigger that could get data of the type specified as a component prop?
OK I will try to implement that, are there any references which might be helpful ? |
this feature would be highly appreciated! |
Will wrap it up next week. |
All Submissions:
Type of change
Please delete options that are not relevant.
New Feature Submission:
Changes To Core Features:
After these steps, you're ready to open a pull request.
Description
Added event handler of on paste event
Linked Issue
Closes #3055