Only delete saved on hitting reset, fixes #744

This commit is contained in:
Ansis Brammanis
2013-02-13 17:42:46 -05:00
parent e60c9ab16b
commit 1050faab8f
2 changed files with 10 additions and 7 deletions
+8 -6
View File
@@ -175,12 +175,7 @@ iD.History = function(context) {
if (!lock) return;
context.storage(getKey('lock'), null);
if (stack.length <= 1) {
context.storage(getKey('history'), null);
context.storage(getKey('nextIDs'), null);
context.storage(getKey('index'), null);
return;
}
if (stack.length <= 1) return;
var json = JSON.stringify(stack.map(function(i) {
return {
@@ -198,6 +193,13 @@ iD.History = function(context) {
context.storage(getKey('index'), index);
},
clearSaved: function() {
if (!lock) return;
context.storage(getKey('history'), null);
context.storage(getKey('nextIDs'), null);
context.storage(getKey('index'), null);
},
lock: function() {
if (context.storage(getKey('lock'))) return false;
context.storage(getKey('lock'), true);
+2 -1
View File
@@ -34,7 +34,8 @@ iD.ui.Restore = function(context) {
.attr('class', 'cancel button col6')
.text(t('restore.reset'))
.on('click', function() {
context.history().clearSaved();
modal.remove();
});
}
};
};