Skip to content

Commit

Permalink
Fix Copy/Cut command not working in webview (#206529)
Browse files Browse the repository at this point in the history
* Fix Copy/Cut command not working in webview

* Update Content-Security-Policy of index.html

* Update csp

---------

Co-authored-by: Matt Bierner <matb@microsoft.com>
  • Loading branch information
yiliang114 and mjbvz authored Mar 11, 2024
1 parent e081917 commit d4b4c32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
const interval = 250;
let isFocused = document.hasFocus();
setInterval(() => {
const isCurrentlyFocused = document.hasFocus();
const target = getActiveFrame();
const isCurrentlyFocused = document.hasFocus() || !!(target && target.contentDocument && target.contentDocument.body.classList.contains('vscode-context-menu-visible'));
if (isCurrentlyFocused === isFocused) {
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/contrib/webview/browser/pre/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">

<meta http-equiv="Content-Security-Policy"
content="default-src 'none'; script-src 'sha256-zUToXLPvfhhGwJ9G2aKXxI1DL+LnafBpNyx1mQ/S5qU=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
content="default-src 'none'; script-src 'sha256-bQPwjO6bLiyf6v9eDVtAI67LrfonA1w49aFkRXBy4/g=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">

<!-- Disable pinch zooming -->
<meta name="viewport"
Expand Down Expand Up @@ -47,7 +47,8 @@
const interval = 250;
let isFocused = document.hasFocus();
setInterval(() => {
const isCurrentlyFocused = document.hasFocus();
const target = getActiveFrame();
const isCurrentlyFocused = document.hasFocus() || !!(target && target.contentDocument && target.contentDocument.body.classList.contains('vscode-context-menu-visible'));
if (isCurrentlyFocused === isFocused) {
return;
}
Expand Down

0 comments on commit d4b4c32

Please sign in to comment.