mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { webContents } from 'electron';
|
||||
import { WebContents, webContents } from 'electron';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { ITunnelService } from 'vs/platform/remote/common/tunnel';
|
||||
import { IRequestService } from 'vs/platform/request/common/request';
|
||||
import { IWebviewManagerService, RegisterWebviewMetadata } from 'vs/platform/webview/common/webviewManagerService';
|
||||
import { IWebviewManagerService, RegisterWebviewMetadata, WebviewWebContentsId, WebviewWindowId } from 'vs/platform/webview/common/webviewManagerService';
|
||||
import { WebviewPortMappingProvider } from 'vs/platform/webview/electron-main/webviewPortMappingProvider';
|
||||
import { WebviewProtocolProvider } from 'vs/platform/webview/electron-main/webviewProtocolProvider';
|
||||
import { IWindowsMainService } from 'vs/platform/windows/electron-main/windows';
|
||||
@@ -26,7 +26,7 @@ export class WebviewMainService extends Disposable implements IWebviewManagerSer
|
||||
@IFileService fileService: IFileService,
|
||||
@IRequestService requestService: IRequestService,
|
||||
@ITunnelService tunnelService: ITunnelService,
|
||||
@IWindowsMainService windowsMainService: IWindowsMainService,
|
||||
@IWindowsMainService private readonly windowsMainService: IWindowsMainService,
|
||||
) {
|
||||
super();
|
||||
this.protocolProvider = this._register(new WebviewProtocolProvider(fileService, requestService, windowsMainService));
|
||||
@@ -70,11 +70,24 @@ export class WebviewMainService extends Disposable implements IWebviewManagerSer
|
||||
});
|
||||
}
|
||||
|
||||
public async setIgnoreMenuShortcuts(webContentsId: number, enabled: boolean): Promise<void> {
|
||||
const contents = webContents.fromId(webContentsId);
|
||||
if (!contents) {
|
||||
throw new Error(`Invalid webContentsId: ${webContentsId}`);
|
||||
public async setIgnoreMenuShortcuts(id: WebviewWebContentsId | WebviewWindowId, enabled: boolean): Promise<void> {
|
||||
let contents: WebContents | undefined;
|
||||
|
||||
if (typeof (id as WebviewWindowId).windowId === 'number') {
|
||||
const { windowId } = (id as WebviewWindowId);
|
||||
const window = this.windowsMainService.getWindowById(windowId);
|
||||
if (!window) {
|
||||
throw new Error(`Invalid windowId: ${windowId}`);
|
||||
}
|
||||
contents = window.win.webContents;
|
||||
} else {
|
||||
const { webContentsId } = (id as WebviewWebContentsId);
|
||||
contents = webContents.fromId(webContentsId);
|
||||
if (!contents) {
|
||||
throw new Error(`Invalid webContentsId: ${webContentsId}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!contents.isDestroyed()) {
|
||||
contents.setIgnoreMenuShortcuts(enabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user