Skip to content

Conversation

@tyrellshawn
Copy link

Generated with codex (since anthropic is playing unfair currently). Tested using the examples but havent done any integration tests with opencode yet.

@tyrellshawn tyrellshawn changed the title Detect image events feat: detect image events on paste with ctrl +v or command v Jan 17, 2026
@Hona
Copy link
Collaborator

Hona commented Jan 17, 2026

I think we currently have paste detection in a few places - including in opencode repo.

How does this differ to that?

@kommander
Copy link
Collaborator

@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
Copy link
Collaborator

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?

Copy link
Author

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?

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants