diff --git a/Oqtane.Client/Body.razor b/Oqtane.Client/Body.razor
deleted file mode 100644
index 8f28ce95..00000000
--- a/Oqtane.Client/Body.razor
+++ /dev/null
@@ -1,33 +0,0 @@
-@using System.ComponentModel
-@using Oqtane.Shared
-@inject SiteState SiteState
-
-@((MarkupString)content)
-
-@code {
- private string content = "";
-
- protected override void OnInitialized()
- {
- ((INotifyPropertyChanged)SiteState.Properties).PropertyChanged += PropertyChanged;
- }
-
- private void PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- switch (e.PropertyName)
- {
- case "BodyContent":
- if (content != SiteState.Properties.BodyContent)
- {
- content = SiteState.Properties.BodyContent;
- StateHasChanged();
- }
- break;
- }
- }
-
- public void Dispose()
- {
- ((INotifyPropertyChanged)SiteState.Properties).PropertyChanged -= PropertyChanged;
- }
-}
\ No newline at end of file
diff --git a/Oqtane.Client/Head.razor b/Oqtane.Client/Head.razor
index edc2da06..28e2455d 100644
--- a/Oqtane.Client/Head.razor
+++ b/Oqtane.Client/Head.razor
@@ -19,22 +19,30 @@
switch (e.PropertyName)
{
case "PageTitle":
- if (title != SiteState.Properties.PageTitle)
- {
- title = "\n
" + SiteState.Properties.PageTitle + "";
- StateHasChanged();
- }
+ title = "\n" + SiteState.Properties.PageTitle + "";
+ StateHasChanged();
break;
case "HeadContent":
- if (content != SiteState.Properties.HeadContent)
- {
- content = SiteState.Properties.HeadContent + "\n";
- StateHasChanged();
- }
+ content = RemoveScripts(SiteState.Properties.HeadContent) + "\n";
+ StateHasChanged();
break;
}
}
+ private string RemoveScripts(string headcontent)
+ {
+ if (!string.IsNullOrEmpty(headcontent))
+ {
+ var index = headcontent.IndexOf("") + 9 - index);
+ index = headcontent.IndexOf("", index) + 9 - index);
+ var attributes = script.Substring(0, script.IndexOf(">")).Replace("\"", "").Split(" ");
+ string id = "";
+ string src = "";
+ string integrity = "";
+ string crossorigin = "";
+ string type = "";
+ foreach (var attribute in attributes)
{
- var script = PageState.Page.HeadContent.Substring(index, PageState.Page.HeadContent.IndexOf("", index) + 9 - index);
- var attributes = script.Substring(0, script.IndexOf(">")).Replace("\"", "").Split(" ");
- string id = "";
- string src = "";
- string integrity = "";
- string crossorigin = "";
- string type = "";
- foreach (var attribute in attributes)
+ if (attribute.Contains("="))
{
- if (attribute.Contains("="))
+ var value = attribute.Split("=");
+ switch (value[0])
{
- var value = attribute.Split("=");
- switch (value[0])
- {
- case "id":
- id = value[1];
- break;
- case "src":
- src = value[1];
- break;
- case "integrity":
- integrity = value[1];
- break;
- case "crossorigin":
- crossorigin = value[1];
- break;
- case "type":
- type = value[1];
- break;
- }
+ case "id":
+ id = value[1];
+ break;
+ case "src":
+ src = value[1];
+ break;
+ case "integrity":
+ integrity = value[1];
+ break;
+ case "crossorigin":
+ crossorigin = value[1];
+ break;
+ case "type":
+ type = value[1];
+ break;
}
}
- if (!string.IsNullOrEmpty(src))
- {
- src = (src.Contains("://")) ? src : PageState.Alias.BaseUrl + src;
- await interop.IncludeScript(id, src, integrity, crossorigin, type, "", "head");
- }
- else
- {
- if (id == "")
- {
- count += 1;
- id = $"page{PageState.Page.PageId}-script{count}";
- }
- index = script.IndexOf(">") + 1;
- await interop.IncludeScript(id, "", "", "", script.Substring(index, script.IndexOf("") - index), "head");
- }
- index = PageState.Page.HeadContent.IndexOf("") - index), "head");
+ }
+ index = PageState.Page.HeadContent.IndexOf("") + 9 - index);
- index = headcontent.IndexOf("