mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-25 17:37:49 +02:00
Merge pull request #6302 from openstreetmap/text-raw-tag-editor
Text raw tag editor / Copy-paste tags
This commit is contained in:
@@ -3,7 +3,7 @@ import { actionChangePreset } from '../actions/change_preset';
|
||||
import { actionChangeTags } from '../actions/change_tags';
|
||||
import { actionUpgradeTags } from '../actions/upgrade_tags';
|
||||
import { osmIsOldMultipolygonOuterMember, osmOldMultipolygonOuterMemberOfRelation } from '../osm/multipolygon';
|
||||
import { utilArrayUnion, utilDisplayLabel } from '../util';
|
||||
import { utilDisplayLabel, utilTagDiff } from '../util';
|
||||
import { validationIssue, validationIssueFix } from '../core/validation';
|
||||
|
||||
|
||||
@@ -48,20 +48,7 @@ export function validationOutdatedTags() {
|
||||
}
|
||||
|
||||
// determine diff
|
||||
var keys = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
|
||||
var tagDiff = [];
|
||||
keys.forEach(function(k) {
|
||||
var oldVal = oldTags[k];
|
||||
var newVal = newTags[k];
|
||||
|
||||
if (oldVal && (!newVal || newVal !== oldVal)) {
|
||||
tagDiff.push('- ' + k + '=' + oldVal);
|
||||
}
|
||||
if (newVal && (!oldVal || newVal !== oldVal)) {
|
||||
tagDiff.push('+ ' + k + '=' + newVal);
|
||||
}
|
||||
});
|
||||
|
||||
var tagDiff = utilTagDiff(oldTags, newTags);
|
||||
if (!tagDiff.length) return [];
|
||||
|
||||
return [new validationIssue({
|
||||
@@ -113,10 +100,10 @@ export function validationOutdatedTags() {
|
||||
.attr('class', 'tagDiff-row')
|
||||
.append('td')
|
||||
.attr('class', function(d) {
|
||||
var klass = d.charAt(0) === '+' ? 'add' : 'remove';
|
||||
var klass = d.type === '+' ? 'add' : 'remove';
|
||||
return 'tagDiff-cell tagDiff-cell-' + klass;
|
||||
})
|
||||
.text(function(d) { return d; });
|
||||
.text(function(d) { return d.display; });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { actionChangeTags } from '../actions/change_tags';
|
||||
import { t } from '../util/locale';
|
||||
import { utilDisplayLabel } from '../util';
|
||||
import { utilDisplayLabel, utilTagDiff } from '../util';
|
||||
import { validationIssue, validationIssueFix } from '../core/validation';
|
||||
|
||||
|
||||
@@ -40,20 +40,17 @@ export function validationPrivateData() {
|
||||
|
||||
var validation = function checkPrivateData(entity, context) {
|
||||
var tags = entity.tags;
|
||||
var keepTags = {};
|
||||
var tagDiff = [];
|
||||
if (!tags.building || !privateBuildingValues[tags.building]) return [];
|
||||
|
||||
var keepTags = {};
|
||||
for (var k in tags) {
|
||||
if (publicKeys[k]) return []; // probably a public feature
|
||||
|
||||
if (personalTags[k]) {
|
||||
tagDiff.push('- ' + k + '=' + tags[k]);
|
||||
} else {
|
||||
if (!personalTags[k]) {
|
||||
keepTags[k] = tags[k];
|
||||
}
|
||||
}
|
||||
|
||||
var tagDiff = utilTagDiff(tags, keepTags);
|
||||
if (!tagDiff.length) return [];
|
||||
|
||||
var fixID = tagDiff.length === 1 ? 'remove_tag' : 'remove_tags';
|
||||
@@ -110,10 +107,10 @@ export function validationPrivateData() {
|
||||
.attr('class', 'tagDiff-row')
|
||||
.append('td')
|
||||
.attr('class', function(d) {
|
||||
var klass = d.charAt(0) === '+' ? 'add' : 'remove';
|
||||
var klass = d.type === '+' ? 'add' : 'remove';
|
||||
return 'tagDiff-cell tagDiff-cell-' + klass;
|
||||
})
|
||||
.text(function(d) { return d; });
|
||||
.text(function(d) { return d.display; });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user