Copy Paste bug fixed

This commit is contained in:
Lucas Oliveira 2023-05-29 17:14:08 -03:00
commit 35fd7dabbb
4 changed files with 7 additions and 3 deletions

View file

@ -119,6 +119,7 @@ export default function ParameterComponent({
) : (
<InputComponent
disabled={disabled}
disableCopyPaste={true}
password={data.node.template[name].password ?? false}
value={data.node.template[name].value ?? ""}
onChange={(t) => {

View file

@ -6,11 +6,13 @@ import { TabsContext } from "../../contexts/tabsContext";
export default function InputComponent({
value,
onChange,
disableCopyPaste = false,
disabled,
password,
}: InputComponentType) {
const [myValue, setMyValue] = useState(value ?? "");
const [pwdVisible, setPwdVisible] = useState(false);
const {setDisableCopyPaste} = useContext(TabsContext);
useEffect(() => {
if (disabled) {
setMyValue("");
@ -27,6 +29,8 @@ export default function InputComponent({
>
<input
value={myValue}
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" : "",

View file

@ -317,10 +317,8 @@ export default function FlowPage({ flow }: { flow: FlowType }) {
onPaneClick={() => {
setDisableCopyPaste(false);
}}
onNodeClick={() => {
setDisableCopyPaste(true);
}}
onPaneMouseLeave={() => {
console.log("saiu o mouse")
setDisableCopyPaste(true);
}}
onNodesChange={onNodesChange}

View file

@ -10,6 +10,7 @@ export type InputComponentType = {
disabled?: boolean;
onChange: (value: string) => void;
password: boolean;
disableCopyPaste?: boolean;
};
export type ToggleComponentType = {
enabled: boolean;