diff --git a/DNN Platform/Modules/HTML/Components/HtmlTextController.cs b/DNN Platform/Modules/HTML/Components/HtmlTextController.cs
index 0fd2f5f4229..12e9ff1410d 100644
--- a/DNN Platform/Modules/HTML/Components/HtmlTextController.cs
+++ b/DNN Platform/Modules/HTML/Components/HtmlTextController.cs
@@ -50,8 +50,13 @@ public class HtmlTextController : ModuleSearchBase, IPortable, IUpgradeable
private const string PortalRootToken = "{{PortalRoot}}";
public HtmlTextController()
+ : this(Globals.DependencyProvider.GetRequiredService())
{
- this.NavigationManager = Globals.DependencyProvider.GetRequiredService();
+ }
+
+ public HtmlTextController(INavigationManager navigationManager)
+ {
+ this.NavigationManager = navigationManager;
}
protected INavigationManager NavigationManager { get; }
diff --git a/DNN Platform/Modules/HTML/EditHtml.ascx.cs b/DNN Platform/Modules/HTML/EditHtml.ascx.cs
index d3a0ea7a7d4..285991cdf73 100644
--- a/DNN Platform/Modules/HTML/EditHtml.ascx.cs
+++ b/DNN Platform/Modules/HTML/EditHtml.ascx.cs
@@ -33,13 +33,14 @@ public partial class EditHtml : HtmlModuleBase
{
private readonly INavigationManager _navigationManager;
- private readonly HtmlTextController _htmlTextController = new HtmlTextController();
+ private readonly HtmlTextController _htmlTextController;
private readonly HtmlTextLogController _htmlTextLogController = new HtmlTextLogController();
private readonly WorkflowStateController _workflowStateController = new WorkflowStateController();
public EditHtml()
{
this._navigationManager = this.DependencyProvider.GetRequiredService();
+ this._htmlTextController = new HtmlTextController(this._navigationManager);
}
private enum WorkflowType
diff --git a/DNN Platform/Modules/HTML/HtmlModule.ascx.cs b/DNN Platform/Modules/HTML/HtmlModule.ascx.cs
index 3deafa91492..fbf4cd98815 100644
--- a/DNN Platform/Modules/HTML/HtmlModule.ascx.cs
+++ b/DNN Platform/Modules/HTML/HtmlModule.ascx.cs
@@ -65,7 +65,7 @@ public ModuleActionCollection ModuleActions
false);
// get the content
- var objHTML = new HtmlTextController();
+ var objHTML = new HtmlTextController(this._navigationManager);
var objWorkflow = new WorkflowStateController();
this.WorkflowID = objHTML.GetWorkflow(this.ModuleId, this.TabId, this.PortalId).Value;
@@ -159,7 +159,7 @@ protected override void OnInit(EventArgs e)
this.EditorEnabled = this.PortalSettings.InlineEditorEnabled;
try
{
- this.WorkflowID = new HtmlTextController().GetWorkflow(this.ModuleId, this.TabId, this.PortalId).Value;
+ this.WorkflowID = new HtmlTextController(this._navigationManager).GetWorkflow(this.ModuleId, this.TabId, this.PortalId).Value;
// Add an Action Event Handler to the Skin
this.AddActionHandler(this.ModuleAction_Click);
@@ -182,7 +182,7 @@ protected override void OnLoad(EventArgs e)
base.OnLoad(e);
try
{
- var objHTML = new HtmlTextController();
+ var objHTML = new HtmlTextController(this._navigationManager);
// edit in place
if (this.EditorEnabled && this.IsEditable && Personalization.GetUserMode() == PortalSettings.Mode.Edit)
@@ -290,7 +290,7 @@ private void lblContent_UpdateLabel(object source, DNNLabelEditEventArgs e)
else if (this.EditorEnabled && this.IsEditable && Personalization.GetUserMode() == PortalSettings.Mode.Edit)
{
// get content
- var objHTML = new HtmlTextController();
+ var objHTML = new HtmlTextController(this._navigationManager);
var objWorkflow = new WorkflowStateController();
HtmlTextInfo objContent = objHTML.GetTopHtmlText(this.ModuleId, false, this.WorkflowID);
if (objContent == null)
@@ -336,7 +336,7 @@ private void ModuleAction_Click(object sender, ActionEventArgs e)
if (this.IsEditable && Personalization.GetUserMode() == PortalSettings.Mode.Edit)
{
// get content
- var objHTML = new HtmlTextController();
+ var objHTML = new HtmlTextController(this._navigationManager);
HtmlTextInfo objContent = objHTML.GetTopHtmlText(this.ModuleId, false, this.WorkflowID);
var objWorkflow = new WorkflowStateController();
diff --git a/DNN Platform/Modules/HTML/Settings.ascx.cs b/DNN Platform/Modules/HTML/Settings.ascx.cs
index dd83c3a8b9f..4e8d5f501dc 100644
--- a/DNN Platform/Modules/HTML/Settings.ascx.cs
+++ b/DNN Platform/Modules/HTML/Settings.ascx.cs
@@ -5,11 +5,14 @@ namespace DotNetNuke.Modules.Html
{
using System;
using System.Collections;
- using System.Collections.Generic;
+ using System.Collections.Generic;
+ using DotNetNuke.Abstractions;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Modules.Html.Components;
- using DotNetNuke.Services.Exceptions;
+ using DotNetNuke.Services.Exceptions;
+
+ using Microsoft.Extensions.DependencyInjection;
///
/// The Settings ModuleSettingsBase is used to manage the
@@ -21,6 +24,13 @@ public partial class Settings : ModuleSettingsBase
{
private HtmlModuleSettings _moduleSettings;
+ private readonly INavigationManager _navigationManager;
+
+ public Settings()
+ {
+ this._navigationManager = this.DependencyProvider.GetRequiredService();
+ }
+
private new HtmlModuleSettings ModuleSettings
{
get
@@ -40,7 +50,7 @@ public override void LoadSettings()
{
if (!this.Page.IsPostBack)
{
- var htmlTextController = new HtmlTextController();
+ var htmlTextController = new HtmlTextController(this._navigationManager);
var workflowStateController = new WorkflowStateController();
this.chkReplaceTokens.Checked = this.ModuleSettings.ReplaceTokens;
@@ -89,7 +99,7 @@ public override void UpdateSettings()
{
try
{
- var htmlTextController = new HtmlTextController();
+ var htmlTextController = new HtmlTextController(this._navigationManager);
// update replace token setting
this.ModuleSettings.ReplaceTokens = this.chkReplaceTokens.Checked;