-
Notifications
You must be signed in to change notification settings - Fork 310
feat: detect image events on paste with ctrl +v or command v #520
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
base: main
Are you sure you want to change the base?
Conversation
|
I think we currently have paste detection in a few places - including in opencode repo. How does this differ to that? |
|
@Hona I told them that I want to provide that on a library level, as apps would have to re-implement that and pasting binary data like images seems quite common. |
|
|
||
| export class PasteEvent { | ||
| text: string | ||
| data: Buffer |
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.
I wonder if the PasteEvent should maybe only have data and we drop text as for large pastes like images it would always toString duplicate the data, while consumers of the paste event can do the toString when it is actually text content and not a file?
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.
I agree but how would we define the data interface. As long as we know it can do toString we are good? I feel like having a getFileType method in the interface would be good too?
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.
Just as data: Buffer? The PasteEvent has the optional fileType.
Generated with codex (since anthropic is playing unfair currently). Tested using the examples but havent done any integration tests with opencode yet.