diff --git a/src/Blazor.Server.UI/Pages/_Layout.cshtml b/src/Blazor.Server.UI/Pages/_Layout.cshtml
index 680f4f631..a1bcee87b 100644
--- a/src/Blazor.Server.UI/Pages/_Layout.cshtml
+++ b/src/Blazor.Server.UI/Pages/_Layout.cshtml
@@ -103,7 +103,7 @@
-
+
diff --git a/src/Blazor.Server.UI/Services/JsInterop/Fancybox.cs b/src/Blazor.Server.UI/Services/JsInterop/Fancybox.cs
index 5e71bbc58..b96afa104 100644
--- a/src/Blazor.Server.UI/Services/JsInterop/Fancybox.cs
+++ b/src/Blazor.Server.UI/Services/JsInterop/Fancybox.cs
@@ -14,6 +14,6 @@ public Fancybox(IJSRuntime jsRuntime)
public async Task Preview(string defaultUrl, IEnumerable images)
{
var jsmodule =await _jsRuntime.InvokeAsync("import", "/js/fancybox.js");
- return jsmodule.InvokeVoidAsync("previewImage", defaultUrl, images.Select(x => x.Url).ToArray());
+ return jsmodule.InvokeVoidAsync(JSInteropConstants.PreviewImage, defaultUrl, images.Select(x => x.Url).ToArray());
}
}
diff --git a/src/Blazor.Server.UI/Services/JsInterop/InputClear.cs b/src/Blazor.Server.UI/Services/JsInterop/InputClear.cs
index 622573677..8b2cfe54c 100644
--- a/src/Blazor.Server.UI/Services/JsInterop/InputClear.cs
+++ b/src/Blazor.Server.UI/Services/JsInterop/InputClear.cs
@@ -11,9 +11,10 @@ public InputClear(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
- public ValueTask Clear(string targetId)
+ public async Task Clear(string targetId)
{
- return _jsRuntime.InvokeVoidAsync(JSInteropConstants.ClearInput, targetId);
+ var jsmodule = await _jsRuntime.InvokeAsync("import", "/js/clearinput.js");
+ return jsmodule.InvokeVoidAsync(JSInteropConstants.ClearInput, targetId);
}
diff --git a/src/Blazor.Server.UI/Services/JsInterop/JSInteropConstants.cs b/src/Blazor.Server.UI/Services/JsInterop/JSInteropConstants.cs
index ad4eaeb47..c151590df 100644
--- a/src/Blazor.Server.UI/Services/JsInterop/JSInteropConstants.cs
+++ b/src/Blazor.Server.UI/Services/JsInterop/JSInteropConstants.cs
@@ -2,7 +2,8 @@
public class JSInteropConstants
{
- public static string ShowOpenSeadragon => "showOpenSeadragon";
+ public static string ShowOpenSeadragon="showOpenSeadragon";
public static string ClearInput = "clearInput";
+ public static string PreviewImage = "previewImage";
public static string CreateOrgChart = "createOrgChart";
}
diff --git a/src/Blazor.Server.UI/Services/JsInterop/OpenSeadragon.cs b/src/Blazor.Server.UI/Services/JsInterop/OpenSeadragon.cs
index 25e637f24..7e5e21b18 100644
--- a/src/Blazor.Server.UI/Services/JsInterop/OpenSeadragon.cs
+++ b/src/Blazor.Server.UI/Services/JsInterop/OpenSeadragon.cs
@@ -10,10 +10,11 @@ public OpenSeadragon(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
- public ValueTask Open(string url)
+ public async Task Open(string url)
{
var target = "openseadragon";
- return _jsRuntime.InvokeVoidAsync(JSInteropConstants.ShowOpenSeadragon, target, url);
+ var jsmodule = await _jsRuntime.InvokeAsync("import", "/js/openseadragon.js");
+ return jsmodule.InvokeVoidAsync(JSInteropConstants.ShowOpenSeadragon, target, url);
}
diff --git a/src/Blazor.Server.UI/wwwroot/js/clearinput.js b/src/Blazor.Server.UI/wwwroot/js/clearinput.js
new file mode 100644
index 000000000..d26f1eaea
--- /dev/null
+++ b/src/Blazor.Server.UI/wwwroot/js/clearinput.js
@@ -0,0 +1,8 @@
+export function clearInput(inputId) {
+ setTimeout(function () {
+ var input = document.querySelector("#" + inputId);
+ if (input) {
+ input.value = "";
+ }
+ }, 30);
+}
\ No newline at end of file
diff --git a/src/Blazor.Server.UI/wwwroot/js/openseadragon.js b/src/Blazor.Server.UI/wwwroot/js/openseadragon.js
new file mode 100644
index 000000000..32b55af20
--- /dev/null
+++ b/src/Blazor.Server.UI/wwwroot/js/openseadragon.js
@@ -0,0 +1,20 @@
+import OpenSeadragon from 'https://cdn.jsdelivr.net/npm/openseadragon@4.1.0/+esm'
+
+export function showOpenSeadragon(element, url) {
+ var viewer = OpenSeadragon({
+ id: element,
+ showNavigator: false,
+ showZoomControl: false,
+ showHomeControl: false,
+ showFullPageControl: false,
+ showSequenceControl: false,
+ maxZoomPixelRatio: 3,
+ minZoomImageRatio: 0.3,
+ tileSources: {
+ xmlns: "http://schemas.microsoft.com/deepzoom/2008",
+ type: 'image',
+ url: url,
+ }
+ });
+ console.log(viewer)
+}
\ No newline at end of file