Prevent also pasting
This commit is contained in:
@@ -80,7 +80,7 @@ export const SetHookDialog: React.FC<{ accountAddress: string }> = React.memo(
|
|||||||
});
|
});
|
||||||
const [formInitialized, setFormInitialized] = useState(false);
|
const [formInitialized, setFormInitialized] = useState(false);
|
||||||
const [estimateLoading, setEstimateLoading] = useState(false);
|
const [estimateLoading, setEstimateLoading] = useState(false);
|
||||||
|
const watchedFee = watch("Fee");
|
||||||
// Update value if activeWat changes
|
// Update value if activeWat changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValue(
|
setValue(
|
||||||
@@ -89,6 +89,14 @@ export const SetHookDialog: React.FC<{ accountAddress: string }> = React.memo(
|
|||||||
);
|
);
|
||||||
setFormInitialized(true);
|
setFormInitialized(true);
|
||||||
}, [snap.activeWat, snap.files, setValue]);
|
}, [snap.activeWat, snap.files, setValue]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
watchedFee &&
|
||||||
|
(watchedFee.includes(".") || watchedFee.includes(","))
|
||||||
|
) {
|
||||||
|
setValue("Fee", watchedFee.replaceAll(".", "").replaceAll(",", ""));
|
||||||
|
}
|
||||||
|
}, [watchedFee, setValue]);
|
||||||
// const {
|
// const {
|
||||||
// fields: grantFields,
|
// fields: grantFields,
|
||||||
// append: grantAppend,
|
// append: grantAppend,
|
||||||
|
|||||||
@@ -37,22 +37,22 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
txFields,
|
txFields,
|
||||||
} = txState;
|
} = txState;
|
||||||
|
|
||||||
const transactionsOptions = transactionsData.map(tx => ({
|
const transactionsOptions = transactionsData.map((tx) => ({
|
||||||
value: tx.TransactionType,
|
value: tx.TransactionType,
|
||||||
label: tx.TransactionType,
|
label: tx.TransactionType,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const accountOptions: SelectOption[] = accounts.map(acc => ({
|
const accountOptions: SelectOption[] = accounts.map((acc) => ({
|
||||||
label: acc.name,
|
label: acc.name,
|
||||||
value: acc.address,
|
value: acc.address,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const destAccountOptions: SelectOption[] = accounts
|
const destAccountOptions: SelectOption[] = accounts
|
||||||
.map(acc => ({
|
.map((acc) => ({
|
||||||
label: acc.name,
|
label: acc.name,
|
||||||
value: acc.address,
|
value: acc.address,
|
||||||
}))
|
}))
|
||||||
.filter(acc => acc.value !== selectedAccount?.value);
|
.filter((acc) => acc.value !== selectedAccount?.value);
|
||||||
|
|
||||||
const [feeLoading, setFeeLoading] = useState(false);
|
const [feeLoading, setFeeLoading] = useState(false);
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
const specialFields = ["TransactionType", "Account", "Destination"];
|
const specialFields = ["TransactionType", "Account", "Destination"];
|
||||||
|
|
||||||
const otherFields = Object.keys(txFields).filter(
|
const otherFields = Object.keys(txFields).filter(
|
||||||
k => !specialFields.includes(k)
|
(k) => !specialFields.includes(k)
|
||||||
) as [keyof TxFields];
|
) as [keyof TxFields];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -190,7 +190,7 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
{otherFields.map(field => {
|
{otherFields.map((field) => {
|
||||||
let _value = txFields[field];
|
let _value = txFields[field];
|
||||||
|
|
||||||
let value: string | undefined;
|
let value: string | undefined;
|
||||||
@@ -223,8 +223,13 @@ export const TxUI: FC<UIProps> = ({
|
|||||||
</Text>
|
</Text>
|
||||||
<Input
|
<Input
|
||||||
value={value}
|
value={value}
|
||||||
onChange={e => {
|
onChange={(e) => {
|
||||||
handleSetField(field, e.target.value);
|
let value = e.target.value;
|
||||||
|
if (value && (value.includes(".") || value.includes(","))) {
|
||||||
|
value = value.replaceAll(".", "").replaceAll(",", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSetField(field, value);
|
||||||
}}
|
}}
|
||||||
css={{ width: "70%", flex: "inherit" }}
|
css={{ width: "70%", flex: "inherit" }}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user