Skip to content

Commit 2dcfc05

Browse files
author
John McCambridge
committed
Prevent VS Code from auto-focusing markdown preview on update
1 parent 0cd4e46 commit 2dcfc05

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/vscode.patch

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ index 780147c..2e8c9af 100644
785785
- if (platform.isMacintosh) {
786786
+ if (browser.isMacintosh) {
787787
diff --git a/src/vs/workbench/contrib/webview/electron-browser/webview-pre.js b/src/vs/workbench/contrib/webview/electron-browser/webview-pre.js
788-
index 74fc798..03728d0 100644
788+
index 74fc798..f54b539 100644
789789
--- a/src/vs/workbench/contrib/webview/electron-browser/webview-pre.js
790790
+++ b/src/vs/workbench/contrib/webview/electron-browser/webview-pre.js
791791
@@ -10 +10,19 @@
@@ -824,6 +824,15 @@ index 74fc798..03728d0 100644
824824
+ // supportFetchAPI: true,
825825
+ // corsEnabled: true
826826
+ // });
827+
@@ -310 +328 @@
828+
-
829+
+
830+
@@ -328 +346,4 @@
831+
- newFrame.contentWindow.focus();
832+
+ /* Comment out to avoid VS Code from focusing on markdown preview on reload */
833+
+ if (document.hasFocus()) {
834+
+ newFrame.contentWindow.focus();
835+
+ }
827836
diff --git a/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
828837
index 484ff86..f3f57cb 100644
829838
--- a/src/vs/workbench/contrib/webview/electron-browser/webview.contribution.ts
@@ -885,7 +894,7 @@ index 48ef482..dc47f81 100644
885894
- placeHolder: isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select to open (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select to open (hold Ctrl-key to open in new window)"),
886895
+ placeHolder: browser.isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select to open (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select to open (hold Ctrl-key to open in new window)"),
887896
diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts
888-
index 71bc992..111ce51 100644
897+
index 71bc992..2692f39 100644
889898
--- a/src/vs/workbench/electron-browser/main.contribution.ts
890899
+++ b/src/vs/workbench/electron-browser/main.contribution.ts
891900
@@ -13 +13,2 @@ import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';

0 commit comments

Comments
 (0)