Skip to content

Commit

Permalink
Revert 18e9e49, only ask to close window if user has changed something
Browse files Browse the repository at this point in the history
(closes #1507)
  • Loading branch information
bhousel committed Aug 5, 2024
1 parent 1753174 commit 695d7f2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/core/EditSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ export class EditSystem extends AbstractSystem {

// Setup event handlers
window.addEventListener('beforeunload', e => {
e.preventDefault();
this.saveBackup();
return (e.returnValue = ''); // show browser prompt
if (this._history.length > 1) { // user did something
e.preventDefault();
this.saveBackup();
return (e.returnValue = ''); // show browser prompt
}
});

window.addEventListener('unload', () => this._mutex.unlock());
Expand Down

0 comments on commit 695d7f2

Please sign in to comment.