Skip to content

Instantly share code, notes, and snippets.

@benvillalobos
Last active February 15, 2024 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benvillalobos/9ac9add31f9377489719693ed07ba2c7 to your computer and use it in GitHub Desktop.
Save benvillalobos/9ac9add31f9377489719693ed07ba2c7 to your computer and use it in GitHub Desktop.
vscode-webview-copy

There is a CopyToClipboard message that the webview sends.

This means the webview needs to send the copy to clipboard message, while sending the contents to copy within the message.

So within a react file I might have access to the window! <- confirmed

Extension sees the rightclick -> Copy command

Extension tells webview to copy via CopyToClipboard

Webview sees message, sends highlighted text back to extension via CopyToClipboard

Extension receives message, places highlighted section in clipboard.

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