Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change calling js #321

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading