Add tab navigation prevention while in Editable mode
This commit is contained in:
@@ -86,8 +86,20 @@ export function DashboardCanvas({ view, setView, layout, setLayout, onLayoutChan
|
||||
// defaultValue="widget"
|
||||
value={ view }
|
||||
// onValueChange={ setView }
|
||||
onValueChange={(e) => setView(e.value)}
|
||||
// onValueChange={(value) => setView(value)}
|
||||
// onValueChange={(e) => setView(e.value)}
|
||||
onValueChange={(e) => {
|
||||
const nextView = e.value;
|
||||
|
||||
if (view === "widget" && isEditable && nextView !== "widget") {
|
||||
const confirmed = window.confirm(
|
||||
"You have unsaved changes. Do you wish to discard them and continue?"
|
||||
);
|
||||
if (!confirmed) return;
|
||||
onCancel();
|
||||
}
|
||||
setView(nextView);
|
||||
}}
|
||||
>
|
||||
<Flex
|
||||
as="header"
|
||||
|
||||
Reference in New Issue
Block a user