From 50cfe0dbd92442fdd49c04087e14efdcf4356d31 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Fri, 8 Jul 2022 11:58:41 +0200 Subject: [PATCH] Use the default Theia spinner. Signed-off-by: Akos Kitta --- .../src/browser/style/index.css | 18 --------------- .../theia/core/frontend-application.ts | 22 ------------------- electron/build/scripts/patch-theia-preload.js | 16 -------------- electron/build/template-package.json | 2 +- 4 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 electron/build/scripts/patch-theia-preload.js diff --git a/arduino-ide-extension/src/browser/style/index.css b/arduino-ide-extension/src/browser/style/index.css index e4fe0cf7d..bf2907139 100644 --- a/arduino-ide-extension/src/browser/style/index.css +++ b/arduino-ide-extension/src/browser/style/index.css @@ -108,21 +108,3 @@ button.theia-button.main { .fa-reload { font-size: 14px; } - -/* restore the old Theia spinner */ -/* https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318 */ -.old-theia-preload { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: 50000; - background: var(--theia-editor-background); - background-image: var(--theia-preloader); - background-size: 60px 60px; - background-repeat: no-repeat; - background-attachment: fixed; - background-position: center; - transition: opacity 0.8s; -} diff --git a/arduino-ide-extension/src/browser/theia/core/frontend-application.ts b/arduino-ide-extension/src/browser/theia/core/frontend-application.ts index ba02d295e..cb1a96206 100644 --- a/arduino-ide-extension/src/browser/theia/core/frontend-application.ts +++ b/arduino-ide-extension/src/browser/theia/core/frontend-application.ts @@ -32,26 +32,4 @@ export class FrontendApplication extends TheiaFrontendApplication { } }); } - - protected override getStartupIndicator( - host: HTMLElement - ): HTMLElement | undefined { - let startupElement = this.doGetStartupIndicator(host, 'old-theia-preload'); // https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318 - if (!startupElement) { - startupElement = this.doGetStartupIndicator(host, 'theia-preload'); // We show the new Theia spinner in dev mode. - } - return startupElement; - } - - private doGetStartupIndicator( - host: HTMLElement, - classNames: string - ): HTMLElement | undefined { - const elements = host.getElementsByClassName(classNames); - const first = elements[0]; - if (first instanceof HTMLElement) { - return first; - } - return undefined; - } } diff --git a/electron/build/scripts/patch-theia-preload.js b/electron/build/scripts/patch-theia-preload.js deleted file mode 100644 index e4b94d7c9..000000000 --- a/electron/build/scripts/patch-theia-preload.js +++ /dev/null @@ -1,16 +0,0 @@ -// Patch the Theia spinner: https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318 -// Replaces the `theia-preload` selector with `old-theia-preload` in the generated `index.html`. -let arg = process.argv.splice(2)[0] -if (!arg) { - console.error("The path to the index.html to patch is missing. Use 'node patch-theia-preload.js ./path/to/index.html'") - process.exit(1) -} -(async () => { - const { promises: fs } = require('fs') - const path = require('path') - const index = path.isAbsolute(arg) ? arg : path.join(process.cwd(), arg) - console.log(`>>> Patching 'theia-preload' with 'old-theia-preload' in ${index}.`) - const content = await fs.readFile(index, { encoding: 'utf-8' }) - await fs.writeFile(index, content.replace(/theia-preload/g, 'old-theia-preload'), { encoding: 'utf-8' }) - console.log(`<<< Successfully patched index.html.`) -})() \ No newline at end of file diff --git a/electron/build/template-package.json b/electron/build/template-package.json index caa8087cd..cdb7bd2e7 100644 --- a/electron/build/template-package.json +++ b/electron/build/template-package.json @@ -23,7 +23,7 @@ "package": "cross-env DEBUG=* && electron-builder --publish=never", "package:publish": "cross-env DEBUG=* && electron-builder --publish=always", "download:plugins": "theia download:plugins", - "patch": "ncp ./patch/main.js ./src-gen/backend/main.js && node ./scripts/patch-theia-preload.js ./lib/index.html" + "patch": "ncp ./patch/main.js ./src-gen/backend/main.js" }, "engines": { "node": ">=14.0.0 <15"