Remove "key=value" pasting into raw tag editor key

(Reverts: #6211, #5070, #5024)

The old code allows users to circumvent the readonly tag protection
see https://github.com/openstreetmap/iD/issues/6185#issuecomment-488692351

We'll offer a text-mode instead, with stricter checks on which keys can be modified.
This commit is contained in:
Bryan Housel
2019-05-02 10:22:37 -04:00
parent ea40634ac6
commit af97f09150
+2 -20
View File
@@ -77,7 +77,7 @@ export function uiRawTagEditor(context) {
// --------- EXPERIMENT!
var options = wrap.selectAll('.raw-tag-options')
.data([0])
.data([0]);
var optionsEnter = options.enter()
.append('div')
@@ -362,25 +362,7 @@ export function uiRawTagEditor(context) {
_pendingChange[kOld] = undefined;
}
// if the key looks like "key=value key2=value2", split them up - #5024
var keys = (kNew.match(/[\w_]+=/g) || []).map(function (key) { return key.slice(0, -1); });
var vals = keys.length === 0
? []
: kNew
.split(new RegExp(keys.map(function (key) { return key.replace('_', '\\_'); }).join('|')))
.splice(1)
.map(function (val) { return val.slice(1).trim(); });
if (keys.length > 0) {
kNew = keys[0];
vNew = vals[0];
keys.forEach(function (key, i) {
_pendingChange[key] = vals[i];
});
} else {
_pendingChange[kNew] = vNew;
}
_pendingChange[kNew] = vNew;
d.key = kNew; // update datum to avoid exit/enter on tag update
d.value = vNew;