diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 15675d621..5430795e9 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -12,7 +12,7 @@ export default function InputComponent({ }: InputComponentType) { const [myValue, setMyValue] = useState(value ?? ""); const [pwdVisible, setPwdVisible] = useState(false); - const {setDisableCopyPaste} = useContext(TabsContext); + const { setDisableCopyPaste } = useContext(TabsContext); useEffect(() => { if (disabled) { setMyValue(""); @@ -29,8 +29,12 @@ export default function InputComponent({ > {if(disableCopyPaste) setDisableCopyPaste(true)}} - onBlur={() => {if(disableCopyPaste) setDisableCopyPaste(false)}} + onFocus={() => { + if (disableCopyPaste) setDisableCopyPaste(true); + }} + onBlur={() => { + if (disableCopyPaste) setDisableCopyPaste(false); + }} 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" : "", diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 0c69a6931..a373ad9a7 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -87,6 +87,19 @@ export function TabsProvider({ children }: { children: ReactNode }) { cookieObject.flows.forEach((flow) => { flow.data.nodes.forEach((node) => { if (Object.keys(templates[node.data.type]["template"]).length > 0) { + node.data.node.base_classes = + templates[node.data.type]["base_classes"]; + flow.data.edges.forEach((edge) => { + if (edge.source === node.id) { + edge.sourceHandle = edge.sourceHandle + .split("|") + .slice(0, 2) + .concat(templates[node.data.type]["base_classes"]) + .join("|"); + } + }); + node.data.node.description = + templates[node.data.type]["description"]; node.data.node.template = updateTemplate( templates[node.data.type][ "template" @@ -276,6 +289,18 @@ export function TabsProvider({ children }: { children: ReactNode }) { if (data) { data.nodes.forEach((node) => { if (Object.keys(templates[node.data.type]["template"]).length > 0) { + node.data.node.base_classes = + templates[node.data.type]["base_classes"]; + flow.data.edges.forEach((edge) => { + if (edge.source === node.id) { + edge.sourceHandle = edge.sourceHandle + .split("|") + .slice(0, 2) + .concat(templates[node.data.type]["base_classes"]) + .join("|"); + } + }); + node.data.node.description = templates[node.data.type]["description"]; node.data.node.template = updateTemplate( templates[node.data.type]["template"] as unknown as APITemplateType, node.data.node.template as APITemplateType diff --git a/src/frontend/src/pages/FlowPage/index.tsx b/src/frontend/src/pages/FlowPage/index.tsx index 91c853f9b..f1a1f3b74 100644 --- a/src/frontend/src/pages/FlowPage/index.tsx +++ b/src/frontend/src/pages/FlowPage/index.tsx @@ -318,7 +318,7 @@ export default function FlowPage({ flow }: { flow: FlowType }) { setDisableCopyPaste(false); }} onPaneMouseLeave={() => { - console.log("saiu o mouse") + console.log("saiu o mouse"); setDisableCopyPaste(true); }} onNodesChange={onNodesChange}