Skip to content

Commit 80b4a8c

Browse files
author
pipeline
committed
config(EJ2-4392): theme loading issue fix in master branch
1 parent cc1baa7 commit 80b4a8c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/common/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,14 @@ function navigateURL(arg: Controls & Samples, isInteracted: boolean): void {
285285
}
286286
}
287287
function loadTheme(theme: string): void {
288-
let doc: HTMLFormElement = <HTMLFormElement>document.getElementById('themelink');
289-
selectedTheme = theme;
290-
doc.href = 'styles/' + selectedTheme + '.css';
291-
select('#themeswitcher-icon').setAttribute('src', 'styles/images/sb_icons/SB_Switcher_icon_' + theme + '.png');
292-
document.getElementById(theme).style.background = '#DEDFE0';
288+
let ajax: Ajax = new Ajax('./styles/' + theme + '.css', 'GET', true);
289+
ajax.send().then((result: any) => {
290+
let doc: HTMLFormElement = <HTMLFormElement>document.getElementById('themelink');
291+
selectedTheme = theme;
292+
doc.href = 'styles/' + selectedTheme + '.css';
293+
select('#themeswitcher-icon').setAttribute('src', 'styles/images/sb_icons/SB_Switcher_icon_' + theme + '.png');
294+
document.getElementById(theme).style.background = '#DEDFE0';
295+
});
293296
}
294297
function addRoutes(samplesList: Controls[]): void {
295298
for (let node of samplesList) {

0 commit comments

Comments
 (0)