From bc6f0737523f8ab9731e790b75b282b06ec2da16 Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Wed, 24 Sep 2025 12:40:18 +0200 Subject: [PATCH] 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. --- ui/src/components/popovers/PasteModal.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/src/components/popovers/PasteModal.tsx b/ui/src/components/popovers/PasteModal.tsx index 6f224eb5..4686d150 100644 --- a/ui/src/components/popovers/PasteModal.tsx +++ b/ui/src/components/popovers/PasteModal.tsx @@ -17,6 +17,7 @@ import { TextAreaWithLabel } from "@components/TextArea"; // uint32 max value / 4 const pasteMaxLength = 1073741824; +const defaultDelay = 20; export default function PasteModal() { const TextAreaRef = useRef(null); @@ -27,10 +28,10 @@ export default function PasteModal() { const { executeMacro, cancelExecuteMacro } = useKeyboard(); const [invalidChars, setInvalidChars] = useState([]); - const [delayValue, setDelayValue] = useState(100); + const [delayValue, setDelayValue] = useState(defaultDelay); const delay = useMemo(() => { - if (delayValue < 50 || delayValue > 65534) { - return 100; + if (delayValue < 0 || delayValue > 65534) { + return defaultDelay; } return delayValue; }, [delayValue]); @@ -40,7 +41,7 @@ export default function PasteModal() { const delayClassName = useMemo(() => debugMode ? "" : "hidden", [debugMode]); const { setKeyboardLayout } = useSettingsStore(); - const { selectedKeyboard } = useKeyboardLayout(); + const { selectedKeyboard } = useKeyboardLayout(); useEffect(() => { send("getKeyboardLayout", {}, (resp: JsonRpcResponse) => { @@ -136,7 +137,7 @@ export default function PasteModal() {
e.stopPropagation()} - onKeyDown={e => e.stopPropagation()} onKeyDownCapture={e => e.stopPropagation()} + onKeyDown={e => e.stopPropagation()} onKeyDownCapture={e => e.stopPropagation()} onKeyUpCapture={e => e.stopPropagation()} >