Skip to content

Commit edf32e4

Browse files
author
Akos Kitta
committed
Restored the old app spinner.
Signed-off-by: Akos Kitta <[email protected]>
1 parent a13516c commit edf32e4

File tree

5 files changed

+43
-2
lines changed

5 files changed

+43
-2
lines changed

arduino-ide-extension/src/browser/style/index.css

+18
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,21 @@ button.theia-button.main {
108108
.fa-reload {
109109
font-size: 14px;
110110
}
111+
112+
/* restore the old Theia spinner */
113+
/* https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318 */
114+
.old-theia-preload {
115+
position: absolute;
116+
top: 0;
117+
left: 0;
118+
right: 0;
119+
bottom: 0;
120+
z-index: 50000;
121+
background: var(--theia-editor-background);
122+
background-image: var(--theia-preloader);
123+
background-size: 60px 60px;
124+
background-repeat: no-repeat;
125+
background-attachment: fixed;
126+
background-position: center;
127+
transition: opacity 0.8s;
128+
}

arduino-ide-extension/src/browser/theia/core/frontend-application.ts

+7
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,11 @@ export class FrontendApplication extends TheiaFrontendApplication {
3434
}
3535
}
3636
}
37+
38+
protected getStartupIndicator(host: HTMLElement): HTMLElement | undefined {
39+
const startupElements = host.getElementsByClassName('old-theia-preload'); // https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318
40+
return startupElements.length === 0
41+
? undefined
42+
: (startupElements[0] as HTMLElement);
43+
}
3744
}

electron-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"electron": "^15.3.5"
3030
},
3131
"scripts": {
32-
"prepare": "theia build --mode development",
32+
"prepare": "theia build --mode development && node ./scripts/patch-theia-preload.js ./lib/index.html",
3333
"start": "theia start --plugins=local-dir:../plugins",
3434
"watch": "theia build --watch --mode development"
3535
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Patch the Theia spinner: https://github.com/eclipse-theia/theia/pull/10761#issuecomment-1131476318
2+
// Replaces the `theia-preload` selector with `old-theia-preload` in the generated `index.html`.
3+
let arg = process.argv.splice(2)[0]
4+
if (!arg) {
5+
console.error("The path to the index.html to patch is missing. Use 'node patch-theia-preload.js ./path/to/index.html'")
6+
process.exit(1)
7+
}
8+
(async () => {
9+
const { promises: fs } = require('fs')
10+
const path = require('path')
11+
const index = path.isAbsolute(arg) ? arg : path.join(process.cwd(), arg)
12+
console.log(`>>> Patching 'theia-preload' with 'old-theia-preload' in ${index}.`)
13+
const content = await fs.readFile(index, { encoding: 'utf-8' })
14+
await fs.writeFile(index, content.replace(/theia-preload/g, 'old-theia-preload'), { encoding: 'utf-8' })
15+
console.log(`<<< Successfully patched index.html.`)
16+
})()

electron/build/template-package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"package": "cross-env DEBUG=* && electron-builder --publish=never",
2626
"package:publish": "cross-env DEBUG=* && electron-builder --publish=always",
2727
"download:plugins": "theia download:plugins",
28-
"patch": "ncp ./patch/main.js ./src-gen/backend/main.js"
28+
"patch": "ncp ./patch/main.js ./src-gen/backend/main.js && node ../../electron-app/scripts/patch-theia-preload.js ./lib/index.html"
2929
},
3030
"engines": {
3131
"node": ">=14.0.0 <15"

0 commit comments

Comments
 (0)