Browse Source

Only change onbeforeunload when that option is set

pull/1417/head
Duarte Henriques 8 years ago
parent
commit
eddf8764dd
  1. 6
      src/editor/model/Editor.js

6
src/editor/model/Editor.js

@ -137,10 +137,8 @@ module.exports = Backbone.Model.extend({
const stm = this.get('StorageManager'); const stm = this.get('StorageManager');
const changes = this.get('changesCount'); const changes = this.get('changesCount');
if (this.config.noticeOnUnload && changes) { if (this.config.noticeOnUnload) {
window.onbeforeunload = e => 1; window.onbeforeunload = changes ? e => 1 : null;
} else {
window.onbeforeunload = null;
} }
if (stm.isAutosave() && changes >= stm.getStepsBeforeSave()) { if (stm.isAutosave() && changes >= stm.getStepsBeforeSave()) {

Loading…
Cancel
Save