Closed JaneSjs closed 6 months ago
Customers can use the following code:
const options = {
showThemeTab: true
};
const creator = new SurveyCreator.SurveyCreator(options);
const themeTabPlugin = creator.themeEditor;
let isResettingChanges = false;
themeTabPlugin.onThemeSelected.add((s, o) => {
if(!s.isModified) return;
Survey.settings.confirmActionAsync("Do you want to reset all changes?", (confirm) => {
if (confirm) {
if(isResettingChanges) return;
isResettingChanges = true;
s.model.setTheme({ themeName: s.model.themeName, isPanelless: s.model.themeMode === "lightweight", colorPalette: s.model.themePalette });
isResettingChanges = false;
}
});
});
Here is the live example - https://plnkr.co/edit/BMTNURUoIZhZyEwJ
T16845 - When selecting another theme, the customized background and other properties remain between the themes https://surveyjs.answerdesk.io/internal/ticket/details/T16845
Usage scenario: When a user changes a theme, handle this and reset all user-defined settings and display a theme in its initial configuration.
So, we need the following APIs: