From bc4fc307ab8d63475f62027e359bbbf291056531 Mon Sep 17 00:00:00 2001 From: "hualin.zhu" Date: Sun, 22 Oct 2023 11:46:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20javascript=20isolation=20for=20?= =?UTF-8?q?=20facybox.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Products/Products.razor | 8 +++- .../Pages/Products/_ProductFormDialog.razor | 3 +- src/Blazor.Server.UI/Pages/_Layout.cshtml | 43 +++---------------- src/Blazor.Server.UI/Program.cs | 1 + .../Services/JsInterop/Fancybox.cs | 19 ++++++++ src/Blazor.Server.UI/wwwroot/js/fancybox.js | 24 +++++++++++ 6 files changed, 58 insertions(+), 40 deletions(-) create mode 100644 src/Blazor.Server.UI/Services/JsInterop/Fancybox.cs create mode 100644 src/Blazor.Server.UI/wwwroot/js/fancybox.js diff --git a/src/Blazor.Server.UI/Pages/Products/Products.razor b/src/Blazor.Server.UI/Pages/Products/Products.razor index 4f4c2c050..cd89d6da9 100644 --- a/src/Blazor.Server.UI/Pages/Products/Products.razor +++ b/src/Blazor.Server.UI/Pages/Products/Products.razor @@ -18,11 +18,17 @@ @attribute [Authorize(Policy = Permissions.Products.View)] @Title - +

test

images) { - await JS.InvokeVoidAsync("previewImage", url, images.Select(x => x.Url).ToArray()); + await new Fancybox(JS).Preview(url, images); } private async Task UploadFiles(InputFileChangeEventArgs e) diff --git a/src/Blazor.Server.UI/Pages/_Layout.cshtml b/src/Blazor.Server.UI/Pages/_Layout.cshtml index 436bca9d2..d81d2492d 100644 --- a/src/Blazor.Server.UI/Pages/_Layout.cshtml +++ b/src/Blazor.Server.UI/Pages/_Layout.cshtml @@ -12,13 +12,11 @@ - + +