Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -14,6 +14,14 @@ namespace BootstrapBlazor.Components;
/// for when the document is loaded.</remarks>
public partial class OfficeViewer
{
private const string StylePath = "_content/BootstrapBlazor.OfficeViewer/office-viewer.css";

#if NET9_0_OR_GREATER
private string StyleUrl => Assets[StylePath];
#else
private static string StyleUrl => StylePath;
#endif

/// <summary>
/// Gets or sets the url for the Office file to be displayed.
/// </summary>
Expand Down Expand Up @@ -81,7 +89,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
{
LoadedCallaback = nameof(TriggerOnLoaded),
Url = GetAbsoluteUri(Url)
});
}, StyleUrl);

private string GetAbsoluteUri(string? url)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { addLink } from "../BootstrapBlazor/modules/utility.js"
import Data from "../BootstrapBlazor/modules/data.js"

export async function init(id, invoke, options) {
await addLink("./_content/BootstrapBlazor.OfficeViewer/office-viewer.css");
export async function init(id, invoke, options, styleUrl) {
await addLink(styleUrl)

const el = document.getElementById(id);
const officeViewer = { el, invoke, options };
Expand Down
Loading