-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Desktop: Fix Paste image on empty input #7130
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
Desktop: Fix Paste image on empty input #7130
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, I found several related PRs that might be duplicates or address similar paste/clipboard/image functionality: Potential Related PRs:
These PRs are related to clipboard and image handling, but none appear to be exact duplicates of PR #7130. However, PR #6455 (auto-compress clipboard images) and PR #6005 (handle image extensions) seem closest in scope to the paste image functionality being fixed. |
| } | ||
|
|
||
| const handlePaste = async (event: ClipboardEvent) => { | ||
| if (!isFocused()) return |
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.
why remove this? this was added because of conflicts between the terminal component and the prompt input, does removing it not cause any issues there?
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.
the event is on the this div, the terminal is on a completely different component, maybe when this was added it was checking listening to document paste before?
i tested pasting on terminal and on prompt, seems to be working fine...
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.
and for some reason, adding back this makes the issue come back... so this is somehow acting up....
doing further debugging on this isFocused, it's very buggy right now, sometimes even focusing the input, typing, and pasting, this is still false... very weird
|
@adamdotdevin good catch, the fix ended up being a lot simpler... the real issue is we're focusing before registering the listener... so the actual fix is just that, the rest is cleanup... lemme know if you want me to revert the cleanup and leave only the fix |
Very often when you change session and do cmd+v on an focused and empty prompt, the pasted image from clipboard, it breaks:
Now we should be handling properly: