diff --git a/BlazorDialog/BlazorDialog.csproj b/BlazorDialog/BlazorDialog.csproj
index b623abb..b42a31a 100644
--- a/BlazorDialog/BlazorDialog.csproj
+++ b/BlazorDialog/BlazorDialog.csproj
@@ -12,7 +12,7 @@
blazor blazor-component blazor-dialog dialog modal blazor-modal blazordialog blazormodaldialog blazormodal razor razor-components razorcomponents
$(VersionSuffix)
- 2.3.0
+ 3.0.0
$(Version)-$(VersionSuffix)
BlazorDialog
diff --git a/BlazorDialog/BlazorDialogStore.cs b/BlazorDialog/BlazorDialogStore.cs
index ae7f087..b72493a 100644
--- a/BlazorDialog/BlazorDialogStore.cs
+++ b/BlazorDialog/BlazorDialogStore.cs
@@ -11,6 +11,7 @@ internal class BlazorDialogStore : IBlazorDialogStore
{
private Dictionary registeredDialogs = new Dictionary();
private Dictionary registeredComponentDialogs = new Dictionary();
+
public event Func OnComponentAsDialogsChanged;
public Dialog GetById(string id)
@@ -47,7 +48,7 @@ public async Task RegisterComponentDialog(string id, ComponentDialog options)
}
}
- public void Unregister(Dialog blazorDialog)
+ public void Remove(Dialog blazorDialog)
{
if (blazorDialog.Id != null && registeredDialogs.ContainsKey(blazorDialog.Id))
{
diff --git a/BlazorDialog/Components/ComponentAsDialogContainer.razor b/BlazorDialog/Components/ComponentAsDialogContainer.razor
index bbc3283..f436c63 100644
--- a/BlazorDialog/Components/ComponentAsDialogContainer.razor
+++ b/BlazorDialog/Components/ComponentAsDialogContainer.razor
@@ -7,7 +7,8 @@
Centered="ComponentDialog.Options.Centered" CssClass="@ComponentDialog.Options.CssClass" Size="ComponentDialog.Options.Size"
OnAfterRender="EventUtil.AsNonRenderingEventCallback((bool firstLoad) => OnAfterDialogRender(firstLoad))"
OnAfterHide="ComponentDialog.Options.OnAfterHide" OnAfterShow="ComponentDialog.Options.OnAfterShow"
- OnBeforeHide="ComponentDialog.Options.OnBeforeHide" OnBeforeShow="ComponentDialog.Options.OnBeforeShow">
+ OnBeforeHide="ComponentDialog.Options.OnBeforeHide" OnBeforeShow="ComponentDialog.Options.OnBeforeShow"
+ PreventNavigation="ComponentDialog.Options.PreventNavigation">
}
@@ -16,7 +17,8 @@
}
diff --git a/BlazorDialog/Components/Dialog.razor b/BlazorDialog/Components/Dialog.razor
index 2c14a27..2ca4630 100644
--- a/BlazorDialog/Components/Dialog.razor
+++ b/BlazorDialog/Components/Dialog.razor
@@ -2,6 +2,7 @@
@inject IBlazorDialogStore dialogStore
@namespace BlazorDialog
@implements IDisposable
+@inject ILocationChangingHandler locationChangingHandler
@if (isShowing)
{
@@ -99,6 +100,11 @@
///
[Parameter] public EventCallback OnAfterRender { get; set; }
+ ///
+ /// Allows you to prevent browser navigation when the dialog is shown. Defaults to true.
+ ///
+ [Parameter] public bool PreventNavigation { get; set; } = true;
+
protected TaskCompletionSource