ADefWebserver / ADefWebserver.Module.HtmlTextV2

MIT License
4 stars 1 forks source link

[BUG] "Font" Stylesheet Resources Not Loading (Do Not Have Allowed Extension) #12

Closed thabaum closed 3 months ago

thabaum commented 3 months ago

The following resources ResourceType.Stylesheet related to .woff extension not allowed used by fonts do not get loaded. Maybe new resource type font needs to be introduced or we need to get ahold of the css versions? Or is it ResourceType.Script to load fonts as they are not loaded when looking at dev tools F12 in browser?

    public override List<Resource> Resources => new List<Resource>()
    {
        new Resource { ResourceType = ResourceType.Script, Url = "_content/HtmlEditor.Blazor/HtmlEditor.Blazor.js" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/css/default.css" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/MaterialIcons-Regular.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/roboto-v15-latin-300.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/roboto-v15-latin-700.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/roboto-v15-latin-regular.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-Black.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-BlackIt.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-Bold.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-BoldIt.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-ExtraLight.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-ExtraLightIt.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-It.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-Light.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-LightIt.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-Regular.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-Semibold.woff" },
        new Resource { ResourceType = ResourceType.Stylesheet, Url = "_content/HtmlEditor.Blazor/fonts/SourceSansPro-SemiboldIt.woff" },
    };

The issue is the fonts for the ResourceType.Stylesheet do not pass Oqtane checks due to wrong file extension ending.

Maybe a new ResourceType.Font needs to be introduced or used if available for allowing .woff extensions to be loaded.

image

Do these even need to get loaded?

ADefWebserver commented 3 months ago

Please check that again because I think the problem is they don't get loaded every time but I was definitely loading them on my machine if I'm mistaken I know I was definitely loading them when I was using the Ihost interface method. However it is now marked deprecated...

thabaum commented 3 months ago

I think they are present in the app wwwroot folder so maybe they do not need loaded which is why I was thinking of testing not applying them since they error out. Maybe our machines have these fonts generally, or most of them?

I think we can try not to declare to use them with the resource manager in the Edit.razor and see how it goes.