From 537887d28438f3c68ec98f5bfb91f8643c3e6b05 Mon Sep 17 00:00:00 2001 From: lmg-anon <139719567+lmg-anon@users.noreply.github.com> Date: Sat, 31 Aug 2024 13:33:21 -0300 Subject: [PATCH] Enforce valid range for font size multiplier to ensure usability --- mikupad.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mikupad.html b/mikupad.html index cf4d463..7482dcd 100644 --- a/mikupad.html +++ b/mikupad.html @@ -1932,10 +1932,12 @@ } } -function InputSlider({ label, value, min = 0, max = 100, step = 1, readOnly, onValueChange, ...props }) { +function InputSlider({ label, value, min = 0, max = 100, step = 1, readOnly, strict, onValueChange, ...props }) { const handleChange = (newValue) => { - //if (newValue < min) newValue = min; - //if (newValue > max) newValue = max; + if (strict) { + if (newValue < min) newValue = min; + if (newValue > max) newValue = max; + } onValueChange(newValue); }; @@ -6152,7 +6154,7 @@ <${EditorPreferencesModal} isOpen=${modalState.prompt} closeModal=${() => closeModal("prompt")}> - <${InputSlider} label="Font size multiplier" min="0.5" max="5" step="0.01" + <${InputSlider} label="Font size multiplier" min="0.5" max="5" step="0.01" strict="1" value=${fontSizeMultiplier} onValueChange=${setFontSizeMultiplier}/> <${Checkbox} label="Enable spell checking" value=${spellCheck} onValueChange=${setSpellCheck}/>