Formatting

This commit is contained in:
Lucas Oliveira 2024-03-21 15:35:58 +01:00
commit 1604680ab9

View file

@ -121,23 +121,25 @@ export default function InputComponent({
)} )}
placeholder={password && editNode ? "Key" : placeholder} placeholder={password && editNode ? "Key" : placeholder}
onChange={(e) => { onChange={(e) => {
// if the user copies a password from another input // if the user copies a password from another input
// it might come as ••••••••••• it causes errors // it might come as ••••••••••• it causes errors
// in ascii encoding, so we need to handle it // in ascii encoding, so we need to handle it
if (password) { if (password) {
// check if all chars are • // check if all chars are •
if (e.target.value.split("").every((char) => char === "•")) { if (
setErrorData({ e.target.value.split("").every((char) => char === "•")
title: `Invalid characters: ${e.target.value}`, ) {
list: [ setErrorData({
"It seems you are trying to paste a password. Make sure the value is visible before copying from another field.", title: `Invalid characters: ${e.target.value}`,
], list: [
}); "It seems you are trying to paste a password. Make sure the value is visible before copying from another field.",
} ],
});
}
onChange && onChange(e.target.value); onChange && onChange(e.target.value);
} }
}} }}
onKeyDown={(e) => { onKeyDown={(e) => {
handleKeyDown(e, value, ""); handleKeyDown(e, value, "");
if (blurOnEnter && e.key === "Enter") if (blurOnEnter && e.key === "Enter")