Better save blocking in intro (closes #1795)

Previous code blocked the button click handler only, not the ⌘S keybinding
This commit is contained in:
Bryan Housel
2015-12-15 10:35:57 -05:00
parent 000b4a8819
commit 51ed5b6eb2
2 changed files with 4 additions and 8 deletions
+3 -7
View File
@@ -17,6 +17,9 @@ iD.ui.intro = function(context) {
baseEntities = context.history().graph().base().entities,
introGraph;
// Block saving
context.inIntro(true);
// Load semi-real data used in intro
context.connection().toggle(false).flush();
context.history().reset();
@@ -28,12 +31,6 @@ iD.ui.intro = function(context) {
context.history().merge(d3.values(iD.Graph().load(introGraph).entities));
context.background().bing();
// Block saving
var savebutton = d3.select('#bar button.save'),
save = savebutton.on('click');
savebutton.on('click', null);
context.inIntro(true);
d3.select('.background-layer').style('opacity', 1);
var curtain = d3.curtain();
@@ -67,7 +64,6 @@ iD.ui.intro = function(context) {
context.map().centerZoom(center, zoom);
window.location.replace(hash);
context.inIntro(false);
d3.select('#bar button.save').on('click', save);
});
var navwrap = selection.append('div').attr('class', 'intro-nav-wrap fillD');
+1 -1
View File
@@ -8,7 +8,7 @@ iD.ui.Save = function(context) {
function save() {
d3.event.preventDefault();
if (!saving() && history.hasChanges()) {
if (!context.inIntro() && !saving() && history.hasChanges()) {
context.enter(iD.modes.Save(context));
}
}