Fixed disableCopyPaste on modals
This commit is contained in:
parent
d1f744e4d4
commit
dbb9b8ab81
1 changed files with 19 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { ReactNode } from "react";
|
import { ReactNode, useContext, useEffect, useState } from "react";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import {
|
import {
|
||||||
|
|
@ -9,6 +9,7 @@ import {
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogTrigger,
|
DialogTrigger,
|
||||||
} from "../../components/ui/dialog";
|
} from "../../components/ui/dialog";
|
||||||
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
|
|
||||||
type ContentProps = { children: ReactNode };
|
type ContentProps = { children: ReactNode };
|
||||||
type HeaderProps = { children: ReactNode; description: string };
|
type HeaderProps = { children: ReactNode; description: string };
|
||||||
|
|
@ -96,9 +97,25 @@ function BaseModal({
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { setDisableCopyPaste } = useContext(TabsContext);
|
||||||
|
const [openInner, setOpenInner] = useState(open ?? false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setOpenInner(open);
|
||||||
|
}, [open]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setOpen(openInner);
|
||||||
|
if (openInner) {
|
||||||
|
setDisableCopyPaste(true);
|
||||||
|
} else {
|
||||||
|
setDisableCopyPaste(false);
|
||||||
|
}
|
||||||
|
}, [openInner]);
|
||||||
|
|
||||||
//UPDATE COLORS AND STYLE CLASSSES
|
//UPDATE COLORS AND STYLE CLASSSES
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={openInner} onOpenChange={setOpenInner}>
|
||||||
<DialogTrigger className="w-full" hidden={triggerChild ? false : true}>
|
<DialogTrigger className="w-full" hidden={triggerChild ? false : true}>
|
||||||
{triggerChild}
|
{triggerChild}
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue