From fab45dedcd44137ceaa86e646781b64126dc79ff Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 25 Apr 2019 13:22:30 -0500 Subject: [PATCH] Fix toggling full screen --- packages/ide/src/fill/electron.ts | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/ide/src/fill/electron.ts b/packages/ide/src/fill/electron.ts index 1ef1677b..03901ac2 100644 --- a/packages/ide/src/fill/electron.ts +++ b/packages/ide/src/fill/electron.ts @@ -378,14 +378,25 @@ class BrowserWindow extends EventEmitter { public setFullScreen(fullscreen: boolean): void { if (fullscreen) { - document.documentElement.requestFullscreen(); + document.documentElement.requestFullscreen().catch((error) => { + logger.error(error.message); + }); } else { - document.exitFullscreen(); + document.exitFullscreen().catch((error) => { + logger.error(error.message); + }); } } public isFullScreen(): boolean { - return document.fullscreenEnabled; + // TypeScript doesn't recognize this property. + // tslint:disable no-any + if (typeof (window as any)["fullScreen"] !== "undefined") { + return (window as any)["fullScreen"]; + } + + // tslint:enable no-any + return false; } public isFocused(): boolean {