diff --git a/Oqtane.Client/Modules/Admin/Modules/Settings.razor b/Oqtane.Client/Modules/Admin/Modules/Settings.razor index a949271fa..adf686fb3 100644 --- a/Oqtane.Client/Modules/Admin/Modules/Settings.razor +++ b/Oqtane.Client/Modules/Admin/Modules/Settings.razor @@ -302,13 +302,13 @@ } else { - _activetab = "Settings"; + //_activetab = "Settings"; AddModuleMessage(Localizer["Message.Required.Title"], MessageType.Warning); } } else { - _activetab = "Settings"; + //_activetab = "Settings"; AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning); } } diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor index 360142258..79b7e8b7d 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor @@ -523,7 +523,7 @@ private async Task SavePage() { - _activetab = "Settings"; + //_activetab = "Settings"; validated = true; var interop = new Interop(JSRuntime); if (await interop.FormValid(form)) @@ -672,17 +672,23 @@ } else { + _activetab = "Settings"; + _refresh = true; AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning); } } catch (Exception ex) { await logger.LogError(ex, "Error Saving Page {Page} {Error}", _page, ex.Message); + _activetab = "Settings"; + _refresh = true; AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error); } } else { + _activetab = "Settings"; + _refresh = true; AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning); } } diff --git a/Oqtane.Client/Modules/Controls/QuillJSTextEditor.razor b/Oqtane.Client/Modules/Controls/QuillJSTextEditor.razor index cc458f021..82bbb05f6 100644 --- a/Oqtane.Client/Modules/Controls/QuillJSTextEditor.razor +++ b/Oqtane.Client/Modules/Controls/QuillJSTextEditor.razor @@ -254,11 +254,11 @@ protected override void OnInitialized() { _interop = new QuillEditorInterop(JSRuntime); - if (string.IsNullOrEmpty(Placeholder)) { Placeholder = Localizer["Placeholder"]; } + // _activetab = "Rich"; } protected override void OnParametersSet() @@ -269,6 +269,10 @@ { _activetab = "Raw"; } + // else + // { + // _activetab = "Rich"; + // } } protected override async Task OnAfterRenderAsync(bool firstRender) diff --git a/Oqtane.Client/Modules/Controls/TabPanel.razor b/Oqtane.Client/Modules/Controls/TabPanel.razor index fd1251c74..0944df4a5 100644 --- a/Oqtane.Client/Modules/Controls/TabPanel.razor +++ b/Oqtane.Client/Modules/Controls/TabPanel.razor @@ -30,15 +30,20 @@ else [Parameter] public SecurityAccessLevel? Security { get; set; } // optional - can be used to specify SecurityAccessLevel - public bool IsActive { get; set; } - protected override void OnParametersSet() { base.OnParametersSet(); Parent.AddTabPanel((TabPanel)this); - Heading = string.IsNullOrEmpty(Heading) ? Localize(nameof(Name), Name) : Localize(nameof(Heading), Heading); + if (string.IsNullOrEmpty(Heading)) + { + Heading = Localize(nameof(Name), Name); + } + else + { + Heading = Localize(nameof(Heading), Heading); + } } public string DisplayHeading() diff --git a/Oqtane.Client/Modules/Controls/TabStrip.razor b/Oqtane.Client/Modules/Controls/TabStrip.razor index 70fc51029..e2a3c0f16 100644 --- a/Oqtane.Client/Modules/Controls/TabStrip.razor +++ b/Oqtane.Client/Modules/Controls/TabStrip.razor @@ -8,9 +8,18 @@ @foreach (TabPanel tabPanel in _tabPanels) { } @@ -50,43 +59,16 @@ } } - protected override void OnParametersSet() + protected override void OnParametersSet() { - base.OnParametersSet(); - if (PageState.QueryString.ContainsKey("tab")) { ActiveTab = PageState.QueryString["tab"]; } - if (_tabPanels == null || Refresh) { _tabPanels = new List(); } - - // Ensure the active tab is valid and exists - if (!string.IsNullOrEmpty(ActiveTab) && _tabPanels.Any()) - { - var activeTabExists = _tabPanels.Any(tp => tp.Name.Equals(ActiveTab, StringComparison.OrdinalIgnoreCase)); - if (!activeTabExists) - { - ActiveTab = _tabPanels[0].Name; - } - } - - // Update the active tab in the UI - UpdateActiveTab(); - } - - private void UpdateActiveTab() - { - if (!string.IsNullOrEmpty(ActiveTab) && _tabPanels != null) - { - foreach (var tabPanel in _tabPanels) - { - tabPanel.IsActive = tabPanel.Name.Equals(ActiveTab, StringComparison.OrdinalIgnoreCase); - } - } } internal void AddTabPanel(TabPanel tabPanel) @@ -94,20 +76,12 @@ if (!_tabPanels.Exists(item => item.Name == tabPanel.Name) && IsAuthorized(tabPanel)) { _tabPanels.Add(tabPanel); - if (string.IsNullOrEmpty(ActiveTab)) - { - ActiveTab = tabPanel.Name; - } - UpdateActiveTab(); StateHasChanged(); } - } - - private void SetActiveTab(string tabName) - { - ActiveTab = tabName; - UpdateActiveTab(); - StateHasChanged(); + if (string.IsNullOrEmpty(ActiveTab)) + { + ActiveTab = tabPanel.Name; + } } private bool IsAuthorized(TabPanel tabPanel)