提交 84abe711 编写于 作者: B Benjamin Pasero

Update to Electron 0.37.x (#2559)

上级 96c3dbc1
{
"name": "Code",
"version": "0.8.0-preview",
"version": "0.10.12",
"dependencies": {
"applicationinsights": {
"version": "0.15.6",
......@@ -305,9 +305,9 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz",
"dependencies": {
"nan": {
"version": "2.0.8",
"version": "2.2.0",
"from": "nan@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.8.tgz"
"resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
}
}
}
......@@ -431,9 +431,9 @@
"resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-6.0.1.tgz",
"dependencies": {
"nan": {
"version": "2.0.9",
"version": "2.2.0",
"from": "nan@>=2.0.9 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.9.tgz"
"resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
}
}
},
......@@ -481,9 +481,9 @@
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
},
"nan": {
"version": "2.1.0",
"from": "nan@>=2.1.0 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz"
"version": "2.2.0",
"from": "nan@>=2.0.5 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
}
}
}
......
{
"name": "Code",
"version": "1.0.0",
"electronVersion": "0.35.6",
"electronVersion": "0.37.5",
"author": {
"name": "Microsoft Corporation"
},
......
......@@ -1278,6 +1278,7 @@ declare module Electron {
icon?: NativeImage;
noLink?: boolean;
cancelId?: number;
defaultId?: number;
}
}
......@@ -1797,8 +1798,8 @@ declare module Electron {
}
class Session {
static fromPartition(partition: string): Session;
static defaultSession: Session;
fromPartition(partition: string): Session;
defaultSession: Session;
cookies: any;
clearCache(callback: Function): void;
......@@ -1811,6 +1812,7 @@ declare module Electron {
disableNetworkEmulation(): void;
setCertificateVerifyProc(proc: CertificateVerifyProc): void;
webRequest: any;
flushStorageData(): void;
}
interface CommonElectron {
......
......@@ -80,7 +80,7 @@ export class BaseDropdown extends ActionRunner {
e.preventDefault();
e.stopPropagation();
this.toggleDropdown();
this.show();
}).appendTo(this.$el);
let cleanupFn = labelRenderer(this.$label.getHTMLElement());
......@@ -96,14 +96,6 @@ export class BaseDropdown extends ActionRunner {
this.$label.title(tooltip);
}
/*protected*/ toggleDropdown(): void {
if (this.$el.hasClass('active')) {
this.hide();
} else {
this.show();
}
}
/*protected*/ show(): void {
// noop
}
......@@ -219,7 +211,6 @@ export class DropdownMenu extends BaseDropdown {
/*protected*/ _contextMenuProvider: IContextMenuProvider;
private _menuOptions: IMenuOptions;
/*protected*/ currentContainer: HTMLElement;
/*protected*/ _actions: IAction[];
/*protected*/ actionProvider: IActionProvider;
private menuClassName: string;
......@@ -228,7 +219,6 @@ export class DropdownMenu extends BaseDropdown {
super(container, options);
this._contextMenuProvider = options.contextMenuProvider;
this.currentContainer = null;
this.actions = options.actions || [];
this.actionProvider = options.actionProvider;
this.menuClassName = options.menuClassName || '';
......@@ -273,7 +263,6 @@ export class DropdownMenu extends BaseDropdown {
getMenuClassName: () => this.menuClassName,
onHide: () => {
this.$el.removeClass('active');
this.currentContainer = null;
}
});
}
......
......@@ -670,4 +670,4 @@ export class MainThreadDocuments {
}
}, onUnexpectedError);
}
}
}
\ No newline at end of file
......@@ -127,6 +127,13 @@ export class UpdateManager extends events.EventEmitter {
return;
}
// for some reason updating on Mac causes the local storage not to be flushed.
// we workaround this issue by forcing an explicit flush of the storage data.
// see also https://github.com/Microsoft/vscode/issues/172
if (platform.isMacintosh) {
electron.session.defaultSession.flushStorageData();
}
rawQuitAndUpdate();
});
}
......
......@@ -166,7 +166,7 @@ export class VSCodeWindow {
// For VS theme we can show directly because background is white
const usesLightTheme = /vs($| )/.test(storage.getItem<string>(VSCodeWindow.themeStorageKey));
let showDirectly = usesLightTheme;
let showDirectly = true; // set to false to prevent background color flash (flash should be fixed for Electron >= 0.37.x)
if (showDirectly && !global.windowShow) {
global.windowShow = new Date().getTime();
}
......
......@@ -9,7 +9,7 @@ import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base';
import paths = require('vs/base/common/paths');
import strings = require('vs/base/common/strings');
import {isWindows} from 'vs/base/common/platform';
import {isWindows, isLinux} from 'vs/base/common/platform';
import URI from 'vs/base/common/uri';
import {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel';
import {IEventService} from 'vs/platform/event/common/event';
......@@ -165,17 +165,20 @@ export class TextFileService extends AbstractTextFileService {
// Button order
// Windows: Save | Don't Save | Cancel
// Mac/Linux: Save | Cancel | Don't
// Mac: Save | Cancel | Don't Save
// Linux: Don't Save | Cancel | Save
const save = { label: resourcesToConfirm.length > 1 ? this.mnemonicLabel(nls.localize({ key: 'saveAll', comment: ['&& denotes a mnemonic'] }, "&&Save All")) : this.mnemonicLabel(nls.localize({ key: 'save', comment: ['&& denotes a mnemonic'] }, "&&Save")), result: ConfirmResult.SAVE };
const dontSave = { label: this.mnemonicLabel(nls.localize({ key: 'dontSave', comment: ['&& denotes a mnemonic'] }, "Do&&n't Save")), result: ConfirmResult.DONT_SAVE };
const cancel = { label: nls.localize('cancel', "Cancel"), result: ConfirmResult.CANCEL };
const buttons = [save];
const buttons = [];
if (isWindows) {
buttons.push(dontSave, cancel);
buttons.push(save, dontSave, cancel);
} else if (isLinux) {
buttons.push(dontSave, cancel, save);
} else {
buttons.push(cancel, dontSave);
buttons.push(save, cancel, dontSave);
}
let opts: Electron.Dialog.ShowMessageBoxOptions = {
......@@ -188,6 +191,10 @@ export class TextFileService extends AbstractTextFileService {
cancelId: buttons.indexOf(cancel)
};
if (isLinux) {
opts.defaultId = 2;
}
const choice = this.windowService.getWindow().showMessageBox(opts);
return buttons[choice].result;
......
......@@ -7,7 +7,7 @@
import {TPromise} from 'vs/base/common/winjs.base';
import severity from 'vs/base/common/severity';
import actions = require('vs/base/common/actions');
import {IAction} from 'vs/base/common/actions';
import {Separator} from 'vs/base/browser/ui/actionbar/actionbar';
import dom = require('vs/base/browser/dom');
import {$} from 'vs/base/browser/builder';
......@@ -40,7 +40,6 @@ export class ContextMenuService implements IContextMenuService {
return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638
let menu = new remote.Menu();
let actionToRun: actions.IAction = null;
actions.forEach(a => {
if (a instanceof Separator) {
......@@ -55,7 +54,7 @@ export class ContextMenuService implements IContextMenuService {
accelerator,
enabled: a.enabled,
click: () => {
actionToRun = a;
this.runAction(a, delegate);
}
});
......@@ -84,21 +83,20 @@ export class ContextMenuService implements IContextMenuService {
y *= zoom;
menu.popup(remote.getCurrentWindow(), Math.floor(x), Math.floor(y));
});
});
}
if (delegate.onHide) {
delegate.onHide(false);
}
private runAction(actionToRun: IAction, delegate: IContextMenuDelegate): void {
if (delegate.onHide) {
delegate.onHide(false);
}
if (!actionToRun) {
return;
}
this.telemetryService.publicLog('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' });
this.telemetryService.publicLog('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' });
const context = delegate.getActionsContext ? delegate.getActionsContext() : null;
const res = actionToRun.run(context) || TPromise.as(null);
const context = delegate.getActionsContext ? delegate.getActionsContext() : null;
return actionToRun.run(context) || TPromise.as(null);
});
})
.done(null, e => this.messageService.show(severity.Error, e));
res.done(null, e => this.messageService.show(severity.Error, e));
}
}
......@@ -9,7 +9,7 @@ import {IWindowService} from 'vs/workbench/services/window/electron-browser/wind
import nls = require('vs/nls');
import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService';
import {IConfirmation} from 'vs/platform/message/common/message';
import {isWindows} from 'vs/base/common/platform';
import {isWindows, isLinux} from 'vs/base/common/platform';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
......@@ -38,19 +38,27 @@ export class MessageService extends WorkbenchMessageService {
title: confirmation.title || this.contextService.getConfiguration().env.appName,
message: confirmation.message,
buttons: [
this.mnemonicLabel(confirmation.primaryButton),
this.mnemonicLabel(confirmation.secondaryButton)
isLinux ? this.mnemonicLabel(confirmation.secondaryButton) : this.mnemonicLabel(confirmation.primaryButton),
isLinux ? this.mnemonicLabel(confirmation.primaryButton) : this.mnemonicLabel(confirmation.secondaryButton)
],
noLink: true,
cancelId: 1
};
if (isLinux) {
opts.defaultId = 1; // Linux: buttons are swapped
}
if (confirmation.detail) {
opts.detail = confirmation.detail;
}
let result = this.windowService.getWindow().showMessageBox(opts);
if (isLinux) {
return result === 1 ? true : false; // Linux: buttons are swapped
}
return result === 0 ? true : false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册