mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Changeset refactor
(closes #2633) * move osmChangeJXON from osm service to osmChangeset * cleanup putChangeset for code clarity * adjust params for callbacks (pass changeset around instead of changeset_id) * add commit.reset() to reset changeset object after successful save * improve checks for changeset tags (trim whitespace, etc)
This commit is contained in:
@@ -214,7 +214,6 @@ export function uiCommit(context) {
|
||||
})
|
||||
.on('click.save', function() {
|
||||
dispatch.call('save', this, changeset);
|
||||
changeset = null;
|
||||
});
|
||||
|
||||
saveButton
|
||||
@@ -383,11 +382,11 @@ export function uiCommit(context) {
|
||||
var tags = _.clone(changeset.tags);
|
||||
|
||||
_.forEach(changed, function(v, k) {
|
||||
k = k.trim();
|
||||
k = k.trim().substr(0, 255);
|
||||
if (readOnlyTags.indexOf(k) !== -1) return;
|
||||
|
||||
if (k !== '' && v !== undefined) {
|
||||
tags[k] = v.trim();
|
||||
tags[k] = v.trim().substr(0, 255);
|
||||
} else {
|
||||
delete tags[k];
|
||||
}
|
||||
@@ -402,5 +401,11 @@ export function uiCommit(context) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
commit.reset = function() {
|
||||
changeset = null;
|
||||
};
|
||||
|
||||
|
||||
return utilRebind(commit, dispatch, 'on');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user