mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 14:38:05 +02:00
Correctly trim whitespace in semicolon-separated multivalues #2236
This commit is contained in:
@@ -133,11 +133,13 @@ iD.ui.EntityEditor = function(context) {
|
||||
|
||||
function clean(o) {
|
||||
var out = {}, k, v;
|
||||
/*jshint -W083 */
|
||||
for (k in o) {
|
||||
if (k && (v = o[k]) !== undefined) {
|
||||
out[k] = v.trim();
|
||||
out[k] = v.split(';').map(function(s) { return s.trim(); }).join(';');
|
||||
}
|
||||
}
|
||||
/*jshint +W083 */
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,12 @@ iD.ui.preset.typeCombo = function(field) {
|
||||
}
|
||||
|
||||
function change() {
|
||||
var value = input.value().replace(/\s+/g, '_');
|
||||
var value = input.value()
|
||||
.split(';')
|
||||
.map(function(s) { return s.trim(); })
|
||||
.join(';')
|
||||
.replace(/\s+/g, '_');
|
||||
|
||||
if (field.type === 'typeCombo' && !value) value = 'yes';
|
||||
|
||||
var t = {};
|
||||
|
||||
Reference in New Issue
Block a user