Skip to content

Commit

Permalink
Change calling js (#321)
Browse files Browse the repository at this point in the history
* Change calling js

* Test Repair
  • Loading branch information
Brano5 authored Jun 28, 2024
1 parent 92722ba commit e9e1e9e
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
public TabPage ActivePage { get; set; }
List<TabPage> Pages = new List<TabPage>();

private IJSObjectReference? _module;

internal void AddPage(TabPage tabPage)
{
Pages.Add(tabPage);
Expand All @@ -42,7 +44,15 @@
{
ActivePage = page;

var module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "/js/addToolTipsAndPopOvers.js");
await module.InvokeVoidAsync("addToolTipsAndPopOvers");
await _module.InvokeVoidAsync("addToolTipsAndPopOvers");
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if(firstRender)
await JSRuntime.InvokeAsync<IJSObjectReference>("import", "/_content/AXSharp.Presentation.Blazor.Controls/js/bootstrap.bundle.min.js");

if (_module == null)
_module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "/_content/AXSharp.Presentation.Blazor.Controls/js/addToolTipsAndPopOvers.js");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function addToolTipsAndPopOvers() {
// Initialize tooltips
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});

// Initialize popovers
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl);
});
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public RenderableContentTests(RenderableContentTestsFixture fixture)
Services.AddSingleton<AttributesHandler>();
Services.AddScoped<ViewModelCacheService>();
_projectDirectory = Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName;

JSInterop.SetupModule("/_content/AXSharp.Presentation.Blazor.Controls/js/addToolTipsAndPopOvers.js");
JSInterop.SetupModule("/_content/AXSharp.Presentation.Blazor.Controls/js/bootstrap.bundle.min.js");
}

private void Compare(string fileName, object twin, string presentation)
Expand Down

0 comments on commit e9e1e9e

Please sign in to comment.