Skip to content

Commit

Permalink
Better save blocking in intro (closes #1795)
Browse files Browse the repository at this point in the history
Previous code blocked the button click handler only, not the ⌘S keybinding
  • Loading branch information
bhousel committed Dec 15, 2015
1 parent 000b4a8 commit 51ed5b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions js/id/ui/intro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion js/id/ui/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down

0 comments on commit 51ed5b6

Please sign in to comment.