diff --git a/src/frontend/src/components/floatComponent/index.tsx b/src/frontend/src/components/floatComponent/index.tsx
index 3a09527da..11a1dedbc 100644
--- a/src/frontend/src/components/floatComponent/index.tsx
+++ b/src/frontend/src/components/floatComponent/index.tsx
@@ -1,5 +1,6 @@
-import { useEffect, useState } from "react";
+import { useContext, useEffect, useState } from "react";
import { FloatComponentType } from "../../types/components";
+import { TabsContext } from "../../contexts/tabsContext";
export default function FloatComponent({
value,
@@ -13,6 +14,7 @@ export default function FloatComponent({
onChange("");
}
}, [disabled, onChange]);
+ const {setDisableCP} = useContext(TabsContext)
return (
{
+ setDisableCP(false)
+ }}
+ onFocus={() => {
+ setDisableCP(true)
+ }}
/>
);
diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx
index 67eff6abf..778d9d6ef 100644
--- a/src/frontend/src/components/inputComponent/index.tsx
+++ b/src/frontend/src/components/inputComponent/index.tsx
@@ -1,6 +1,7 @@
-import { useEffect, useState } from "react";
+import { useContext, useEffect, useState } from "react";
import { InputComponentType } from "../../types/components";
import { classNames } from "../../utils";
+import { TabsContext } from "../../contexts/tabsContext";
export default function InputComponent({
value,
@@ -8,79 +9,86 @@ export default function InputComponent({
disabled,
password,
}: InputComponentType) {
- const [myValue, setMyValue] = useState(value ?? "");
- const [pwdVisible, setPwdVisible] = useState(false);
- useEffect(() => {
- if (disabled) {
- setMyValue("");
- onChange("");
- }
- }, [disabled, onChange]);
- return (
-
-
{
- setMyValue(e.target.value);
- onChange(e.target.value);
- }}
- />
-
-
- );
+ const [myValue, setMyValue] = useState(value ?? "");
+ const [pwdVisible, setPwdVisible] = useState(false);
+ const {setDisableCP} = useContext(TabsContext)
+ useEffect(() => {
+ if (disabled) {
+ setMyValue("");
+ onChange("");
+ }
+ }, [disabled, onChange]);
+ return (
+
+
{
+ setDisableCP(false)
+ }}
+ onFocus={() => {
+ setDisableCP(true)
+ }}
+ className={classNames(
+ "block w-full pr-12 form-input dark:bg-gray-900 dark:border-gray-600 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm",
+ disabled ? " bg-gray-200 dark:bg-gray-700" : "",
+ password && !pwdVisible && myValue !== "" ? "password" : ""
+ )}
+ placeholder="Type a text"
+ onChange={(e) => {
+ setMyValue(e.target.value);
+ onChange(e.target.value);
+ }}
+ />
+
+
+ );
}
diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx
index 5381074a2..0effce921 100644
--- a/src/frontend/src/components/inputListComponent/index.tsx
+++ b/src/frontend/src/components/inputListComponent/index.tsx
@@ -1,6 +1,7 @@
import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline";
-import { useEffect, useState } from "react";
+import { useContext, useEffect, useState } from "react";
import { InputListComponentType } from "../../types/components";
+import { TabsContext } from "../../contexts/tabsContext";
var _ = require("lodash");
@@ -16,6 +17,7 @@ export default function InputListComponent({
onChange([""]);
}
}, [disabled, onChange]);
+ const {setDisableCP} = useContext(TabsContext)
return (
{
+ setDisableCP(false)
+ }}
+ onFocus={() => {
+ setDisableCP(true)
+ }}
/>
{idx === inputList.length - 1 ? (
);
}
diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx
index 9905051b2..db122ebb2 100644
--- a/src/frontend/src/contexts/tabsContext.tsx
+++ b/src/frontend/src/contexts/tabsContext.tsx
@@ -26,6 +26,8 @@ const TabsContextInitialValue: TabsContextType = {
downloadFlow: (flow: FlowType) => {},
uploadFlow: () => {},
hardReset: () => {},
+ disableCP:false,
+ setDisableCP:(state:boolean)=>{},
};
export const TabsContext = createContext(
@@ -212,10 +214,13 @@ export function TabsProvider({ children }: { children: ReactNode }) {
return newFlows;
});
}
+ const [disableCP, setDisableCP] = useState(false);
return (
{
+ setDisableCP(false);
+ }}
+ onFocus={() => {
+ setDisableCP(true);
+ }}
/>
@@ -127,6 +133,12 @@ export default function ExportModal() {