mirror of https://github.com/jetkvm/kvm.git
fix: update delay handling in PasteModal component
- Changed default delay value to 20 and adjusted validation to allow values between 0 and 65534. - Cleaned up code formatting for better readability.
This commit is contained in:
parent
fe77acd5f0
commit
bc6f073752
|
@ -17,6 +17,7 @@ import { TextAreaWithLabel } from "@components/TextArea";
|
||||||
|
|
||||||
// uint32 max value / 4
|
// uint32 max value / 4
|
||||||
const pasteMaxLength = 1073741824;
|
const pasteMaxLength = 1073741824;
|
||||||
|
const defaultDelay = 20;
|
||||||
|
|
||||||
export default function PasteModal() {
|
export default function PasteModal() {
|
||||||
const TextAreaRef = useRef<HTMLTextAreaElement>(null);
|
const TextAreaRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
@ -27,10 +28,10 @@ export default function PasteModal() {
|
||||||
const { executeMacro, cancelExecuteMacro } = useKeyboard();
|
const { executeMacro, cancelExecuteMacro } = useKeyboard();
|
||||||
|
|
||||||
const [invalidChars, setInvalidChars] = useState<string[]>([]);
|
const [invalidChars, setInvalidChars] = useState<string[]>([]);
|
||||||
const [delayValue, setDelayValue] = useState(100);
|
const [delayValue, setDelayValue] = useState(defaultDelay);
|
||||||
const delay = useMemo(() => {
|
const delay = useMemo(() => {
|
||||||
if (delayValue < 50 || delayValue > 65534) {
|
if (delayValue < 0 || delayValue > 65534) {
|
||||||
return 100;
|
return defaultDelay;
|
||||||
}
|
}
|
||||||
return delayValue;
|
return delayValue;
|
||||||
}, [delayValue]);
|
}, [delayValue]);
|
||||||
|
|
Loading…
Reference in New Issue