Unable to paste images from clipboard with keyboard shortcut
See original GitHub issueAknowledgements
-
I have checked that there’s no other issue describing the same or similar problem that I currently have, regardless if it has been closed or open.
-
I can confirm that this is not an issue with the Discord website, but it is a problem specific to the WebCord itself.
-
I have tried running the build from the
master
branch and it does not have any fixes implemented according to my issue. -
My issue describes one of the unstable and/or not fully implemented features.
-
I have found a workaround to mitigate or temporarily fix this issue (please write it in Additional context section).
Operating System / Platform
🐧️ Linux
Operating system architecture
x64 (64-bit Intel/AMD)
Electron version
v19.0.1
Application version
v3.2.0
Bug description
I’m unable to paste an image from the clipboard when using the keyboard shortcut(ctrl
+ v
). However, right clicking and choosing “paste” does work.
To reproduce:
- Copy an image from your browser.
- Try pressing
ctrl
+v
in the text box. Nothing happens - Then right click and click on paste. This time the image gets uploaded
- Now press
ctrl
+v
again. Somehow the shortcut works this time.
Additional context
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
Hmm, I guess they are aware of this bug and have a direct access to the clipboard? But if so, maybe there’s a way to actually overwrite
CTRL+V
? I’ll take a look on this, maybe reopen if there will be any chance to workaroundCTRL+V
as well…Actually, this seems to be a Discord Web bug, I can even reproduce it in Chromium – it occurs for images copied between different browser engines. My guesses are it won’t work as well when you would try to copy an image from Chromium and paste it in Discord Web launched in Firefox. And there’s a way to actually fetch image from clipboard without any workarounds, both in WebCord and Chromium – just Discord does that the wrong way. I guess they can actually read the clipboard using the Electron
clipboard
API in their own Electron client, but in browser they use one of the Web APIs which somehow fails to get a tray content and/or handle it properly.So, you should definitely report that to Discord developers, it’s not my fault – even when WebCord actually does some weird workarounds that seems to kinda succeed where it should fail.
Anyway, I still implemented a better workaround, which actually does not modify the tray content (it preserves all of its types) and still works with
CTRL+V
. It works now in two processes:Preload:
paste
event (watches entiredocument
).paste
event.Main:
paste-workaround
channel.paste-workaround
, emitpaste
in currentwebContents
.See commit c3c8b16 for the actual implementation.