refactored script resource declaration to allow for bundling, made script loading async, refactored RichTextEditor to use new method
This commit is contained in:
@ -117,23 +117,13 @@ namespace Oqtane.UI
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadScript(string url, string integrity, string crossorigin)
|
||||
public async Task IncludeScripts(object[] scripts)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _jsRuntime.InvokeVoidAsync("Oqtane.Interop.loadScript", url, integrity, crossorigin);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore exception
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadBootstrapJS()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _jsRuntime.InvokeVoidAsync("Oqtane.Interop.loadBootstrapJS");
|
||||
await _jsRuntime.InvokeVoidAsync(
|
||||
"Oqtane.Interop.includeScripts",
|
||||
(object)scripts);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -33,12 +33,9 @@
|
||||
// manage stylesheets for this page
|
||||
string batch = DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
||||
var links = new List<object>();
|
||||
foreach (Resource resource in PageState.Page.Resources)
|
||||
foreach (Resource resource in PageState.Page.Resources.Where(item => item.ResourceType == ResourceType.Stylesheet))
|
||||
{
|
||||
if (resource.ResourceType == ResourceType.Stylesheet)
|
||||
{
|
||||
links.Add(new { id = "app-stylesheet-" + batch + "-" + (links.Count + 1).ToString("00"), rel = "stylesheet", href = resource.Url, type = "text/css", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "", key = "" });
|
||||
}
|
||||
links.Add(new { id = "app-stylesheet-" + batch + "-" + (links.Count + 1).ToString("00"), rel = "stylesheet", href = resource.Url, type = "text/css", integrity = resource.Integrity ?? "", crossorigin = resource.CrossOrigin ?? "", key = "" });
|
||||
}
|
||||
await interop.IncludeLinks(links.ToArray());
|
||||
await interop.RemoveElementsById("app-stylesheet", "", "app-stylesheet-" + batch + "-00");
|
||||
|
Reference in New Issue
Block a user