Toolbelt.Blazor.HotKeys
Toolbelt.Blazor.HotKeys copied to clipboard
Support to change path of js
I am developing a Chrome extension with Blazor, and _content folder is forbidden to load in browser extension since it is build in restriction.
So, I need to load js from some folder like content instead of _content.
You can check out my source code to see what I am doing at https://github.com/Amazing-Favorites/Amazing-Favorites if you are interested in
Wow, it sounds so cool! And, that's interesting!
Yes, I'll consider supporting creating a browser extension scenario, particularly improve loading JavaScript helper code to be more flexible.
But I'm afraid it will take a while due to this library is just my weekend hobby works.
I appreciate your understanding!
@newbe36524
I released the new version of "Blazor HotKeys", ver.11.1.0.
- https://www.nuget.org/packages/Toolbelt.Blazor.HotKeys/11.1.0
I made this version to be able to disable automatic injection of the client-side script, instead of changing the path of that.
Maybe you can use "Blazor HotKeys" for your browser extension project with the following step.
- Add "Blazor HotKeys" latest version, v.11.1.0, to your project.
<!-- This is "Newbe.BookmarkManager.csproj" file -->
...
<ItemGroup>
...
<!-- 👇 Add this. -->
<PackageReference Include="Toolbelt.Blazor.HotKeys" Version="11.1.0" />
</ItemGroup>
- Add
<script>tag manually to load the client-side script of "Blazor HotKeys" by yourself.
<!-- This is "wwwroot/index.html" file -->
...
<!-- 👇 Add this. -->
<script src="content/Toolbelt.Blazor.HotKeys/script.min.js"></script>
</body>
...
- Add "HotKeys" service. And when doing that, don't forget to the
DisableClientScriptAutoInjectionoption for the HotKeys service totrue.
// This is "Program.cs"
...
public static async Task Main(string[] args)
{
...
// 👇 Add this
builder.Services.AddHotKeys(options =>
{
options.DisableClientScriptAutoInjection = true;
});
...
I hope this will helps you!
WOW, it is cool, I will add a new story to make it done in the next sprint. And I will get back to you if it works.