fix #2387 - improve container selection in Edit Page

This commit is contained in:
sbwalker 2023-06-21 09:20:05 -04:00
parent 05b5d9da9b
commit c3bccbade8

View File

@ -367,11 +367,11 @@
// appearance // appearance
_title = _page.Title; _title = _page.Title;
_themetype = _page.ThemeType; if (string.IsNullOrEmpty(_page.ThemeType))
if (string.IsNullOrEmpty(_themetype))
{ {
_themetype = PageState.Site.DefaultThemeType; _page.ThemeType = PageState.Site.DefaultThemeType;
} }
_themetype = _page.ThemeType;
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype); _containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype);
_containertype = _page.DefaultContainerType; _containertype = _page.DefaultContainerType;
if (string.IsNullOrEmpty(_containertype)) if (string.IsNullOrEmpty(_containertype))
@ -480,10 +480,15 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype); var oldTheme = PageState.Site.Themes.FirstOrDefault(item => item.Themes.Any(themecontrol => themecontrol.TypeName.Equals(_page.ThemeType)));
_containertype = "-"; var newTheme = PageState.Site.Themes.FirstOrDefault(item => item.Themes.Any(themecontrol => themecontrol.TypeName.Equals(_themetype)));
ThemeSettings(); if (oldTheme.ThemeName != newTheme.ThemeName)
StateHasChanged(); {
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype);
_containertype = _containers.First().TypeName;
ThemeSettings();
StateHasChanged();
}
} }
catch (Exception ex) catch (Exception ex)
{ {