Skip to content

Commit

Permalink
Revert "adding new custom drag event handler to allow event bubbling"
Browse files Browse the repository at this point in the history
This reverts commit 39971e0.
  • Loading branch information
swordensen committed Apr 6, 2024
1 parent 67f1aaa commit 44f4fda
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/vs/workbench/contrib/webview/browser/webviewElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 { DragEvent, FromWebviewMessage, KeyEvent, ToWebviewMessage } 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';
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -701,17 +697,6 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
this.window?.dispatchEvent(emulatedKeyboardEvent);
}

private handleDragEvent(type: 'drag', event: DragEvent) {
// Create a fake KeyboardEvent 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.
Expand Down

0 comments on commit 44f4fda

Please sign in to comment.