Improved CSS handling

This commit is contained in:
Shaun Walker
2019-09-21 22:15:44 -04:00
parent 054495056d
commit 5f62957752
15 changed files with 142 additions and 39 deletions

View File

@ -1,11 +1,16 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using Oqtane.Shared;
using Oqtane.Models;
using System.Threading.Tasks;
namespace Oqtane.Modules
{
public class ModuleBase : ComponentBase, IModuleControl
{
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[CascadingParameter]
protected PageState PageState { get; set; }
@ -25,6 +30,16 @@ namespace Oqtane.Modules
return "Modules/" + this.GetType().Namespace + "/";
}
public async Task AddCSS(string Url)
{
if (!Url.StartsWith("http"))
{
Url = ModulePath() + Url;
}
var interop = new Interop(JSRuntime);
await interop.AddCSS("Module:" + Utilities.CreateIdFromUrl(Url), Url);
}
public string NavigateUrl()
{
return NavigateUrl(PageState.Page.Path);