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
Context-Menu COPY is not working in vscode webview, BUT ctrl+c is working fine #141080
Comments
Please put together a minimal example that doesn't rely on an complex extension or connecting to a database You can build on the webview sample for this: https://github.com/microsoft/vscode-extension-samples/tree/main/webview-sample |
@mjbvz , we have already looked into the sample code. In fact, we made the below change in the html returned from _getHtmlForWebview method like below: Original Code:
Replaced with
After making the change, we tried to copy the text using context menu from the Webview but text is not getting copied. |
Also, please let us know if there is any way to disable/greyed-out CUT/PASTE item in context menu. We just need the COPY item in the context menu. |
Logan and I ran into this in the hex editor today as well. |
I'm also seeing this issue with a web view on our extension. I found this, and I think this might be related to the issue: A user replicated this issue while debugging vscode and found out that CTRL+C and right-click->Copy have different implementations. Does anyone know if there is a workaround for this? Or if there'll be a resolution soon? Thanks! |
I have the exact inverse problem in my extension on MacOS (right click copy is working fine, but cmd+c does not work) |
@mjbvz this issue happens on both Windows as well as on Ubuntu. Text is not copied to clipboard. For example, I want to copy docker image sizes from a markdown file, while previewing it. Image attached below: |
Bumping this issue, it's a bit annoying for users when interfacing with a GUI-based extension. |
https://stackoverflow.com/a/73247563/819417 should fix that and also the copy issue for your extension. |
My team is running into this same issue with the Thunder Client extension, as well as the extensions market place. We cannot cut/copy/paste from these. |
The context menu copy function is not working Does this issue occur when all extensions are disabled?: Yes/No VS Code Version: 1.78.2 Steps to Reproduce:
Please watch the video. 243106855-21c79ed2-a064-40ea-92eb-8cdd709ac19a.mp4 |
I'm using a codegpt extension and im not able to copy. what's the point of codegpt then lol |
Should we remove the "copy" context menu action until it's working? It's rather misleading at the moment. |
+1 here on being not able to copy logs from kubernetes addon |
I am having the issue as well in Thunderclient and markdown extensions. Thank you for any work put forward to resolve this. |
ref: #205624, Copy Image command in webview is not working neither. |
@mjbvz I found the cause of the problem. When we right-click on the webview, the right-click menu that appears is actually provided by vscode (not webview), and webview mistakenly regarded this situation as losing focus. When the callback function of the copy command is executed, the activeWebview value cannot be obtained, so no operation is done. When the right-click menu appears, onBlur is executed. The error caused vscode to think that there was no webview in the active state at this time. |
I tried to fix the problem in #206529 : only need to judge whether the right-click menu currently appears when judging whether the webview is focused. |
Issue Type: Bug
Use Case 1:
Expected Result: Text is getting copied to text editor
Actual Result: Text is not getting copied to text editor
Use Case 2:
Expected Result: Text is getting copied to text editor
Actual Result: Text is getting copied to text editor
VS Code version: Code 1.63.2 (899d46d, 2021-12-15T09:40:02.816Z)
OS version: Windows_NT x64 10.0.18363
Restricted Mode: No
System Info
gpu_compositing: disabled_software
multiple_raster_threads: disabled_off
oop_rasterization: disabled_off
opengl: disabled_off
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
Extensions (1)
A/B Experiments
The text was updated successfully, but these errors were encountered: