UX: Trim Lat / Lng and split values with regex #3568 #3571

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-07-24 08:40:27 +02:00
parent 2a002eca78
commit ea8ee0938c

View file

@ -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]);