bugfix: open advanced modal when another modal is open
This commit is contained in:
parent
100c91f591
commit
5b0b9d8d14
2 changed files with 7 additions and 0 deletions
|
|
@ -13,6 +13,7 @@ import { CODE_PROMPT_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||||
import { postCustomComponent, postValidateCode } from "../../controllers/API";
|
import { postCustomComponent, postValidateCode } from "../../controllers/API";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
import { useDarkStore } from "../../stores/darkStore";
|
import { useDarkStore } from "../../stores/darkStore";
|
||||||
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import { codeAreaModalPropsType } from "../../types/components";
|
import { codeAreaModalPropsType } from "../../types/components";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ export default function CodeAreaModal({
|
||||||
}: codeAreaModalPropsType): JSX.Element {
|
}: codeAreaModalPropsType): JSX.Element {
|
||||||
const [code, setCode] = useState(value);
|
const [code, setCode] = useState(value);
|
||||||
const dark = useDarkStore((state) => state.dark);
|
const dark = useDarkStore((state) => state.dark);
|
||||||
|
const unselectAll = useFlowStore((state) => state.unselectAll);
|
||||||
|
|
||||||
const [height, setHeight] = useState<string | null>(null);
|
const [height, setHeight] = useState<string | null>(null);
|
||||||
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
const setSuccessData = useAlertStore((state) => state.setSuccessData);
|
||||||
|
|
@ -45,6 +47,8 @@ export default function CodeAreaModal({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
unselectAll();
|
||||||
|
|
||||||
if (openModal) setOpen(true);
|
if (openModal) setOpen(true);
|
||||||
}, [openModal]);
|
}, [openModal]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import {
|
||||||
import { TypeModal } from "../../constants/enums";
|
import { TypeModal } from "../../constants/enums";
|
||||||
import { postValidatePrompt } from "../../controllers/API";
|
import { postValidatePrompt } from "../../controllers/API";
|
||||||
import useAlertStore from "../../stores/alertStore";
|
import useAlertStore from "../../stores/alertStore";
|
||||||
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import { genericModalPropsType } from "../../types/components";
|
import { genericModalPropsType } from "../../types/components";
|
||||||
import { handleKeyDown } from "../../utils/reactflowUtils";
|
import { handleKeyDown } from "../../utils/reactflowUtils";
|
||||||
import { classNames, varHighlightHTML } from "../../utils/utils";
|
import { classNames, varHighlightHTML } from "../../utils/utils";
|
||||||
|
|
@ -46,6 +47,7 @@ export default function GenericModal({
|
||||||
const textRef = useRef<HTMLTextAreaElement>(null);
|
const textRef = useRef<HTMLTextAreaElement>(null);
|
||||||
const divRef = useRef(null);
|
const divRef = useRef(null);
|
||||||
const divRefPrompt = useRef(null);
|
const divRefPrompt = useRef(null);
|
||||||
|
const unselectAll = useFlowStore((state) => state.unselectAll);
|
||||||
|
|
||||||
function checkVariables(valueToCheck: string): void {
|
function checkVariables(valueToCheck: string): void {
|
||||||
const regex = /\{([^{}]+)\}/g;
|
const regex = /\{([^{}]+)\}/g;
|
||||||
|
|
@ -89,6 +91,7 @@ export default function GenericModal({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInputValue(value);
|
setInputValue(value);
|
||||||
|
unselectAll();
|
||||||
}, [value, modalOpen]);
|
}, [value, modalOpen]);
|
||||||
|
|
||||||
const coloredContent = (inputValue || "")
|
const coloredContent = (inputValue || "")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue