diff --git a/src/vs/workbench/contrib/webview/browser/pre/index.html b/src/vs/workbench/contrib/webview/browser/pre/index.html
index f46e124042850..a831ac3bacad1 100644
--- a/src/vs/workbench/contrib/webview/browser/pre/index.html
+++ b/src/vs/workbench/contrib/webview/browser/pre/index.html
@@ -5,9 +5,7 @@
-
+ content="default-src 'none'; script-src 'sha256-dvxt5dlghGbz8hrqqochfoKEaHIMZ+yJVRvjJnGopzs=' 'self'; frame-src 'self'; style-src 'unsafe-inline';">
void} callback
*/
@@ -898,9 +885,7 @@
window.addEventListener('keydown', handleInnerKeydown);
window.addEventListener('keyup', handleInnerKeyup);
window.addEventListener('dragenter', handleInnerDragStartEvent);
- window.addEventListener('dragover', handleInnerDragEvent);
- window.addEventListener('drag', handleInnerDragEvent);
-
+ window.addEventListener('dragover', handleInnerDragStartEvent);
onDomReady(() => {
if (!document.body) {
@@ -1182,8 +1167,7 @@
});
contentWindow.addEventListener('dragenter', handleInnerDragStartEvent);
- contentWindow.addEventListener('dragover', handleInnerDragEvent);
- contentWindow.addEventListener('drag', handleInnerDragEvent);
+ contentWindow.addEventListener('dragover', handleInnerDragStartEvent);
unloadMonitor.onIframeLoaded(newFrame);
}
diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts
index 8870ddf4cc639..e1efba3e8025e 100644
--- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts
+++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts
@@ -34,7 +34,7 @@ import { loadLocalResource, WebviewResourceResponse } from 'vs/workbench/contrib
import { WebviewThemeDataProvider } from 'vs/workbench/contrib/webview/browser/themeing';
import { areWebviewContentOptionsEqual, IWebview, WebviewContentOptions, WebviewExtensionDescription, WebviewInitInfo, WebviewMessageReceivedEvent, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview';
import { WebviewFindDelegate, WebviewFindWidget } from 'vs/workbench/contrib/webview/browser/webviewFindWidget';
-import { FromWebviewMessage, KeyEvent, ToWebviewMessage, WebViewDragEvent } from 'vs/workbench/contrib/webview/browser/webviewMessages';
+import { FromWebviewMessage, KeyEvent, ToWebviewMessage } from 'vs/workbench/contrib/webview/browser/webviewMessages';
import { decodeAuthority, webviewGenericCspSource, webviewRootResourceAuthority } from 'vs/workbench/contrib/webview/common/webview';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { CodeWindow } from 'vs/base/browser/window';
@@ -310,10 +310,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
this._startBlockingIframeDragEvents();
}));
- this._register(this.on('drag', (event) => {
- this.handleDragEvent('drag', event);
- }));
-
if (initInfo.options.enableFindWidget) {
this._webviewFindWidget = this._register(instantiationService.createInstance(WebviewFindWidget, this));
}
@@ -701,17 +697,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
this.window?.dispatchEvent(emulatedKeyboardEvent);
}
- private handleDragEvent(type: 'drag', event: WebViewDragEvent) {
- // Create a fake DragEvent from the data provided
- const emulatedDragEvent = new DragEvent(type, event);
- // Force override the target
- Object.defineProperty(emulatedDragEvent, 'target', {
- get: () => this.element,
- });
- // And re-dispatch
- this.window?.dispatchEvent(emulatedDragEvent);
- }
-
windowDidDragStart(): void {
// Webview break drag and dropping around the main window (no events are generated when you are over them)
// Work around this by disabling pointer events during the drag.
diff --git a/src/vs/workbench/contrib/webview/browser/webviewMessages.d.ts b/src/vs/workbench/contrib/webview/browser/webviewMessages.d.ts
index dde553ec05724..eae9c80fa6872 100644
--- a/src/vs/workbench/contrib/webview/browser/webviewMessages.d.ts
+++ b/src/vs/workbench/contrib/webview/browser/webviewMessages.d.ts
@@ -17,10 +17,6 @@ type KeyEvent = {
repeat: boolean;
}
-type WebViewDragEvent = {
- shiftKey: boolean;
-}
-
export type FromWebviewMessage = {
'onmessage': { message: any; transfer?: ArrayBuffer[] };
'did-click-link': { uri: string };
@@ -40,7 +36,6 @@ export type FromWebviewMessage = {
'did-keyup': KeyEvent;
'did-context-menu': { clientX: number; clientY: number; context: { [key: string]: unknown } };
'drag-start': void;
- 'drag': WebViewDragEvent
};
interface UpdateContentEvent {
diff --git a/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts b/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts
index d009ae186da59..e4dc5eaf0e904 100644
--- a/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts
+++ b/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.ts
@@ -18,41 +18,19 @@ export class WebviewWindowDragMonitor extends Disposable {
constructor(targetWindow: CodeWindow, getWebview: () => IWebview | undefined) {
super();
- const onDragStart = () => {
+ this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.DRAG_START, () => {
getWebview()?.windowDidDragStart();
- };
+ }));
const onDragEnd = () => {
getWebview()?.windowDidDragEnd();
};
- this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.DRAG_START, () => {
- onDragStart();
- }));
-
this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.DRAG_END, onDragEnd));
-
this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.MOUSE_MOVE, currentEvent => {
if (currentEvent.buttons === 0) {
onDragEnd();
}
}));
-
- this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.DRAG, (event) => {
- if (event.shiftKey) {
- onDragEnd();
- } else {
- onDragStart();
- }
- }));
-
- this._register(DOM.addDisposableListener(targetWindow, DOM.EventType.DRAG_OVER, (event) => {
- if (event.shiftKey) {
- onDragEnd();
- } else {
- onDragStart();
- }
- }));
-
}
}