Skip to content

Commit

Permalink
Merge pull request #8688 from surveyjs/bug/fix-auto-apply-theme
Browse files Browse the repository at this point in the history
Fix auto apply theme
  • Loading branch information
tsv2013 authored Aug 14, 2024
2 parents a69d667 + 985ff51 commit d58ccbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ export class SurveyModel extends SurveyElementCore

constructor(jsonObj: any = null, renderedElement: any = null) {
super();
this.onBeforeRunConstructor();
// if (DomDocumentHelper.isAvailable()) {
// SurveyModel.stylesManager = new StylesManager();
// }
Expand Down Expand Up @@ -6322,6 +6323,7 @@ export class SurveyModel extends SurveyElementCore
};
return [navStart, navPrev, navNext, navPreview, navComplete];
}
protected onBeforeRunConstructor() {}
protected onBeforeCreating() { }
protected onCreating() { }
private getProcessedTextValue(textValue: TextPreProcessorValue): void {
Expand Down
9 changes: 8 additions & 1 deletion src/stylesmanager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { SurveyModel } from "../packages/survey-core/src/survey";
import { surveyCss } from "../packages/survey-core/src/defaultCss/defaultV2Css";
import { DomDocumentHelper } from "../packages/survey-core/src/global_variables_utils";
import { DomDocumentHelper, DomWindowHelper } from "../packages/survey-core/src/global_variables_utils";
import { settings, ISurveyEnvironment } from "../packages/survey-core/src/settings";
import { getElement, isShadowDOM, Logger } from "../packages/survey-core/src/utils/utils";

Expand Down Expand Up @@ -415,3 +416,9 @@ export class StylesManager {
}
}
}
SurveyModel.prototype["onBeforeRunConstructor"] = () => {
if(DomWindowHelper.isAvailable()) {
StylesManager.autoApplyTheme();
}
};

0 comments on commit d58ccbc

Please sign in to comment.