add support for data-reload=false attribute in Interactive rendering
This commit is contained in:
@ -92,6 +92,14 @@
|
||||
{
|
||||
if (!firstRender)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(PageState.Site.HeadContent) && PageState.Site.HeadContent.Contains("<script"))
|
||||
{
|
||||
await InjectScripts(PageState.Site.HeadContent, ResourceLocation.Head);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(PageState.Site.BodyContent) && PageState.Site.BodyContent.Contains("<script"))
|
||||
{
|
||||
await InjectScripts(PageState.Site.BodyContent, ResourceLocation.Body);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(PageState.Page.HeadContent) && PageState.Page.HeadContent.Contains("<script"))
|
||||
{
|
||||
await InjectScripts(PageState.Page.HeadContent, ResourceLocation.Head);
|
||||
@ -180,14 +188,16 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
// inline script must have an id attribute
|
||||
if (id == "")
|
||||
if (dataAttributes == null || !dataAttributes.ContainsKey("data-reload") || dataAttributes["data-reload"] != "false")
|
||||
{
|
||||
count += 1;
|
||||
id = $"page{PageState.Page.PageId}-script{count}";
|
||||
if (id == "")
|
||||
{
|
||||
count += 1;
|
||||
id = $"page{PageState.Page.PageId}-script{count}";
|
||||
}
|
||||
var pos = script.IndexOf(">") + 1;
|
||||
await interop.IncludeScript(id, "", "", "", type, script.Substring(pos, script.IndexOf("</script>") - pos), location.ToString().ToLower(), dataAttributes);
|
||||
}
|
||||
var pos = script.IndexOf(">") + 1;
|
||||
await interop.IncludeScript(id, "", "", "", type, script.Substring(pos, script.IndexOf("</script>") - pos), location.ToString().ToLower(), dataAttributes);
|
||||
}
|
||||
index = content.IndexOf("<script", index + 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user