From 61f6e086c9f062103789ff3d9e0572e1dbf3c73e Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 22 Feb 2024 17:09:40 -0500 Subject: [PATCH] Validates if page is integer --- src/common/Button.svelte | 1 + src/common/Paginator.svelte | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/Button.svelte b/src/common/Button.svelte index d905bbea9..064bd4a8a 100644 --- a/src/common/Button.svelte +++ b/src/common/Button.svelte @@ -205,6 +205,7 @@ } .square { + margin: 0; padding: 0.5rem; } diff --git a/src/common/Paginator.svelte b/src/common/Paginator.svelte index 8ed6a2da0..88b9f5731 100644 --- a/src/common/Paginator.svelte +++ b/src/common/Paginator.svelte @@ -15,12 +15,17 @@ export let has_previous = false; export let goToNav = false; + var isInt = /^[0-9]+$/; + const dispatch = createEventDispatcher(); let input: HTMLInputElement; // proxy the page value so we can reset it if needed let inputValue = page; $: inputWidth = String(inputValue ?? 0).length; - $: invalidValue = inputValue > totalPages || !inputValue; + $: invalidValue = + inputValue > totalPages || + !inputValue || + !isInt.test(inputValue.toString()); $: { inputValue = page; }