From ea8ee0938c22906a9a5277adbf8e0f30b024eeb7 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Mon, 24 Jul 2023 08:40:27 +0200 Subject: [PATCH] UX: Trim Lat / Lng and split values with regex #3568 #3571 Signed-off-by: Michael Mayer --- frontend/src/dialog/photo/edit/details.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/dialog/photo/edit/details.vue b/frontend/src/dialog/photo/edit/details.vue index 18b14dd1e..b9843e1a9 100644 --- a/frontend/src/dialog/photo/edit/details.vue +++ b/frontend/src/dialog/photo/edit/details.vue @@ -481,12 +481,12 @@ export default { // Get values from browser clipboard. const text = clipboard.getData("text"); - const val = text.split(",").map(function(s) { - return s.trim(); - }); + + // Trim spaces before splitting by whitespace and/or commas. + const val = text.trim().split(/[ ,]+/); // Two values found? - if (val.length === 2) { + if (val.length >= 2) { // Parse values. const lat = parseFloat(val[0]); const lng = parseFloat(val[1]);