Fix external theme switching

We need to wait CSS loading
This commit is contained in:
Chocobozzz 2024-11-26 14:56:03 +01:00
parent 5d0e72ba50
commit c40062189b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 7 additions and 0 deletions

View File

@ -127,10 +127,17 @@ export class ThemeService {
private loadThemeStyle (name: string) { private loadThemeStyle (name: string) {
const links = document.getElementsByTagName('link') const links = document.getElementsByTagName('link')
for (let i = 0; i < links.length; i++) { for (let i = 0; i < links.length; i++) {
const link = links[i] const link = links[i]
if (link.getAttribute('rel').includes('style') && link.getAttribute('title')) { if (link.getAttribute('rel').includes('style') && link.getAttribute('title')) {
link.disabled = link.getAttribute('title') !== name link.disabled = link.getAttribute('title') !== name
if (!link.disabled) {
link.onload = () => this.injectColorPalette()
} else {
link.onload = undefined
}
} }
} }