mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 18:48:00 +00:00
parent
355be5e7d3
commit
845202c59e
|
@ -109,13 +109,6 @@ export class Dialog extends Disposable {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.modal) {
|
||||
this._register(domEvent(this.modal, 'mousedown')(e => {
|
||||
// Used to stop focusing of modal with mouse
|
||||
EventHelper.stop(e, true);
|
||||
}));
|
||||
}
|
||||
|
||||
clearNode(this.buttonsContainer);
|
||||
|
||||
let focusedButton = 0;
|
||||
|
|
|
@ -14,14 +14,18 @@ import { attachDialogStyler } from 'vs/platform/theme/common/styler';
|
|||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { EventHelper } from 'vs/base/browser/dom';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
||||
export class DialogService implements IDialogService {
|
||||
_serviceBrand: any;
|
||||
|
||||
private allowableCommands = ['copy', 'cut'];
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@ILayoutService private readonly layoutService: ILayoutService,
|
||||
@IThemeService private readonly themeService: IThemeService
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IKeybindingService private readonly keybindingService: IKeybindingService
|
||||
) { }
|
||||
|
||||
async confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
|
||||
|
@ -50,7 +54,12 @@ export class DialogService implements IDialogService {
|
|||
cancelId: 1,
|
||||
type: confirmation.type,
|
||||
keyEventProcessor: (event: StandardKeyboardEvent) => {
|
||||
EventHelper.stop(event, true);
|
||||
const resolved = this.keybindingService.softDispatch(event, this.layoutService.container);
|
||||
if (resolved && resolved.commandId) {
|
||||
if (this.allowableCommands.indexOf(resolved.commandId) === -1) {
|
||||
EventHelper.stop(event, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
checkboxChecked: confirmation.checkbox ? confirmation.checkbox.checked : undefined,
|
||||
checkboxLabel: confirmation.checkbox ? confirmation.checkbox.label : undefined
|
||||
|
@ -82,7 +91,12 @@ export class DialogService implements IDialogService {
|
|||
cancelId: options ? options.cancelId : undefined,
|
||||
type: this.getDialogType(severity),
|
||||
keyEventProcessor: (event: StandardKeyboardEvent) => {
|
||||
EventHelper.stop(event, true);
|
||||
const resolved = this.keybindingService.softDispatch(event, this.layoutService.container);
|
||||
if (resolved && resolved.commandId) {
|
||||
if (this.allowableCommands.indexOf(resolved.commandId) === -1) {
|
||||
EventHelper.stop(event, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import { DialogChannel } from 'vs/platform/dialogs/node/dialogIpc';
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
|
||||
interface IMassagedMessageBoxOptions {
|
||||
|
||||
|
@ -45,12 +46,13 @@ export class DialogService implements IDialogService {
|
|||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IWindowService windowService: IWindowService,
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService,
|
||||
@IKeybindingService keybindingService: IKeybindingService
|
||||
) {
|
||||
|
||||
// Use HTML based dialogs
|
||||
if (configurationService.getValue('workbench.dialogs.customEnabled') === true) {
|
||||
this.impl = new HTMLDialogService(logService, layoutService, themeService);
|
||||
this.impl = new HTMLDialogService(logService, layoutService, themeService, keybindingService);
|
||||
}
|
||||
// Electron dialog service
|
||||
else {
|
||||
|
@ -187,4 +189,4 @@ class NativeDialogService implements IDialogService {
|
|||
}
|
||||
}
|
||||
|
||||
registerSingleton(IDialogService, DialogService, true);
|
||||
registerSingleton(IDialogService, DialogService, true);
|
||||
|
|
|
@ -348,7 +348,9 @@ export class ProgressService extends Disposable implements IProgressService {
|
|||
const disposables = new DisposableStore();
|
||||
const allowableCommands = [
|
||||
'workbench.action.quit',
|
||||
'workbench.action.reloadWindow'
|
||||
'workbench.action.reloadWindow',
|
||||
'copy',
|
||||
'cut'
|
||||
];
|
||||
|
||||
let dialog: Dialog;
|
||||
|
|
Loading…
Reference in a new issue