Pass RenderMode and Runtime to Head component

This commit is contained in:
sbwalker
2024-02-19 18:30:01 -05:00
parent 4db3bafeda
commit 4fad97e8b1
3 changed files with 29 additions and 13 deletions

View File

@ -19,6 +19,12 @@
private string _title = "";
private string _content = "";
[Parameter]
public string RenderMode { get; set; }
[Parameter]
public string Runtime { get; set; }
protected override void OnInitialized()
{
((INotifyPropertyChanged)SiteState.Properties).PropertyChanged += PropertyChanged;
@ -49,15 +55,15 @@
private string RemoveScripts(string headcontent)
{
// if (!string.IsNullOrEmpty(headcontent))
// {
// var index = headcontent.IndexOf("<script");
// while (index >= 0)
// {
// headcontent = headcontent.Remove(index, headcontent.IndexOf("</script>") + 9 - index);
// index = headcontent.IndexOf("<script");
// }
// }
if (!string.IsNullOrEmpty(headcontent) && RenderMode == RenderModes.Interactive)
{
var index = headcontent.IndexOf("<script");
while (index >= 0)
{
headcontent = headcontent.Remove(index, headcontent.IndexOf("</script>") + 9 - index);
index = headcontent.IndexOf("<script");
}
}
return headcontent;
}