diff --git a/Oqtane.Client/Modules/HtmlText/Edit.razor b/Oqtane.Client/Modules/HtmlText/Edit.razor index 9df38687..c9c94bc7 100644 --- a/Oqtane.Client/Modules/HtmlText/Edit.razor +++ b/Oqtane.Client/Modules/HtmlText/Edit.razor @@ -3,9 +3,8 @@ @using Oqtane.Modules.Controls @namespace Oqtane.Modules.HtmlText @inherits ModuleBase +@inject IHtmlTextService HtmlTextService @inject NavigationManager NavigationManager -@inject HttpClient http -@inject SiteState sitestate @if (_content != null) { @@ -14,7 +13,8 @@ Cancel @if (!string.IsNullOrEmpty(_content)) { -

+
+
} } @@ -35,8 +35,7 @@ { try { - var htmltextservice = new HtmlTextService(http, sitestate); - var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId); + var htmltext = await HtmlTextService.GetHtmlTextAsync(ModuleState.ModuleId); if (htmltext != null) { _content = htmltext.Content; @@ -65,19 +64,18 @@ try { - var htmltextservice = new HtmlTextService(http, sitestate); - var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId); + var htmltext = await HtmlTextService.GetHtmlTextAsync(ModuleState.ModuleId); if (htmltext != null) { htmltext.Content = content; - await htmltextservice.UpdateHtmlTextAsync(htmltext); + await HtmlTextService.UpdateHtmlTextAsync(htmltext); } else { htmltext = new HtmlTextInfo(); htmltext.ModuleId = ModuleState.ModuleId; htmltext.Content = content; - await htmltextservice.AddHtmlTextAsync(htmltext); + await HtmlTextService.AddHtmlTextAsync(htmltext); } await logger.LogInformation("Html/Text Content Saved {HtmlText}", htmltext); diff --git a/Oqtane.Client/Modules/HtmlText/Index.razor b/Oqtane.Client/Modules/HtmlText/Index.razor index c76afa02..6821c425 100644 --- a/Oqtane.Client/Modules/HtmlText/Index.razor +++ b/Oqtane.Client/Modules/HtmlText/Index.razor @@ -1,21 +1,13 @@ @using Oqtane.Modules.HtmlText.Services -@using Oqtane.Modules.HtmlText.Models @namespace Oqtane.Modules.HtmlText @inherits ModuleBase -@inject NavigationManager NavigationManager -@inject HttpClient http -@inject SiteState sitestate +@inject IHtmlTextService HtmlTextService @((MarkupString)content) @if (PageState.EditMode) { -
-} - -@if (PageState.EditMode) -{ -

+


} @code { @@ -25,8 +17,7 @@ { try { - var htmltextservice = new HtmlTextService(http, sitestate); - var htmltext = await htmltextservice.GetHtmlTextAsync(ModuleState.ModuleId); + var htmltext = await HtmlTextService.GetHtmlTextAsync(ModuleState.ModuleId); if (htmltext != null) { content = htmltext.Content; diff --git a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs index cb73b9a4..51ab7887 100644 --- a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs +++ b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs @@ -8,7 +8,7 @@ using Oqtane.Shared; namespace Oqtane.Modules.HtmlText.Services { - public class HtmlTextService : ServiceBase, IHtmlTextService + public class HtmlTextService : ServiceBase, IHtmlTextService, IService { private readonly SiteState _siteState;