mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-10-06 01:58:32 +00:00

- Updated `@theia/*` to `1.37.0`. - Fixed all `yarn audit` security vulnerabilities. - Updated to `electron@23.2.4`: - `contextIsolation` is `true`, - `nodeIntegration` is `false`, and the - `webpack` target is moved from `electron-renderer` to `web`. - Updated to `typescript@4.9.3`. - Updated the `eslint` plugins. - Added the new `Light High Contrast` theme to the IDE2. - High contrast themes use Theia APIs for style adjustments. - Support for ESM modules: `"moduleResolution": "node16"`. - Node.js >= 16.14 is required. - VISX langage packs were bumped to `1.70.0`. - Removed undesired editor context menu items. (Closes #1394) Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
53 lines
1.9 KiB
TypeScript
53 lines
1.9 KiB
TypeScript
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
import type { NewWindowOptions } from '@theia/core/lib/common/window';
|
|
import { ElectronWindowService as TheiaElectronWindowService } from '@theia/core/lib/electron-browser/window/electron-window-service';
|
|
import { injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
import { WindowServiceExt } from '../../../browser/theia/core/window-service-ext';
|
|
import {
|
|
hasStartupTasks,
|
|
StartupTasks,
|
|
} from '../../../electron-common/startup-task';
|
|
|
|
@injectable()
|
|
export class ElectronWindowService
|
|
extends TheiaElectronWindowService
|
|
implements WindowServiceExt
|
|
{
|
|
private _isFirstWindow: Deferred<boolean> | undefined;
|
|
|
|
@postConstruct()
|
|
protected override init(): void {
|
|
// NOOP
|
|
// IDE2 listens on the zoom level changes in `ArduinoFrontendContribution#onStart`
|
|
}
|
|
|
|
async isFirstWindow(): Promise<boolean> {
|
|
if (!this._isFirstWindow) {
|
|
this._isFirstWindow = new Deferred();
|
|
window.electronArduino
|
|
.isFirstWindow()
|
|
.then((isFirstWindow) => this._isFirstWindow?.resolve(isFirstWindow));
|
|
}
|
|
return this._isFirstWindow.promise;
|
|
}
|
|
|
|
// Overridden because the default Theia implementation destructures the additional properties of the `options` arg, such as `tasks`.
|
|
// https://github.com/eclipse-theia/theia/blob/2deedbad70bd4b503bf9c7e733ab9603f492600f/packages/core/src/electron-browser/window/electron-window-service.ts#L43
|
|
override openNewWindow(url: string, options?: NewWindowOptions): undefined {
|
|
return this.delegate.openNewWindow(url, options);
|
|
}
|
|
|
|
// Overridden to support optional task owner params and make `tsc` happy.
|
|
override reload(options?: StartupTasks): void {
|
|
if (hasStartupTasks(options)) {
|
|
window.electronArduino.requestReload(options);
|
|
} else {
|
|
window.electronTheiaCore.requestReload();
|
|
}
|
|
}
|
|
|
|
close(): void {
|
|
window.electronTheiaCore.close();
|
|
}
|
|
}
|