mirror of https://github.com/buster-so/buster.git
pass save events differently
This commit is contained in:
parent
d9bc8d4741
commit
dffc3026cd
|
@ -35,9 +35,7 @@ const SplitterContent: React.FC<{
|
||||||
<PopupSplitter />
|
<PopupSplitter />
|
||||||
|
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Button variant={'default'} onClick={onReset}>
|
<Button onClick={onReset}>Reset</Button>
|
||||||
Reset
|
|
||||||
</Button>
|
|
||||||
<Button
|
<Button
|
||||||
className="flex items-center"
|
className="flex items-center"
|
||||||
variant="black"
|
variant="black"
|
||||||
|
@ -58,14 +56,8 @@ const SplitterContent: React.FC<{
|
||||||
title="Unsaved changes"
|
title="Unsaved changes"
|
||||||
isDirty={open}
|
isDirty={open}
|
||||||
description="Are you sure you want to leave this page?"
|
description="Are you sure you want to leave this page?"
|
||||||
onOk={() => {
|
onOk={onSave}
|
||||||
onSave();
|
onCancel={onReset}
|
||||||
return Promise.resolve();
|
|
||||||
}}
|
|
||||||
onCancel={() => {
|
|
||||||
onReset();
|
|
||||||
return Promise.resolve();
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
@ -36,7 +36,7 @@ const sizeVariants = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const buttonVariants = cva(
|
export const buttonVariants = cva(
|
||||||
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
'inline-flex items-center overflow-hidden text-base justify-center gap-1.5 shadow rounded transition-all duration-300 focus-visible:outline-none disabled:pointer-events-none disabled:cursor-not-allowed data-[loading=true]:cursor-progress',
|
||||||
{
|
{
|
||||||
variants: {
|
variants: {
|
||||||
variant: buttonTypeClasses,
|
variant: buttonTypeClasses,
|
||||||
|
|
|
@ -12,9 +12,9 @@ type PreventNavigationProps = {
|
||||||
description: string;
|
description: string;
|
||||||
cancelText?: string;
|
cancelText?: string;
|
||||||
okText?: string;
|
okText?: string;
|
||||||
onOk: () => Promise<void>;
|
onOk: (() => Promise<void>) | (() => void);
|
||||||
onCancel: () => Promise<void>;
|
onCancel: (() => Promise<void>) | (() => void);
|
||||||
onClose?: () => void;
|
onClose?: (() => Promise<void>) | (() => void);
|
||||||
doNotLeavePageOnOkay?: boolean;
|
doNotLeavePageOnOkay?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ export const PreventNavigation: React.FC<PreventNavigationProps> = React.memo(
|
||||||
document.querySelectorAll('a').forEach((link) => {
|
document.querySelectorAll('a').forEach((link) => {
|
||||||
link.addEventListener('click', handleClick);
|
link.addEventListener('click', handleClick);
|
||||||
});
|
});
|
||||||
}, 0);
|
}, 5);
|
||||||
};
|
};
|
||||||
|
|
||||||
setLeavingPage(true);
|
setLeavingPage(true);
|
||||||
|
|
Loading…
Reference in New Issue