Browse Source

Merge pull request #1417 from dsgh/fix-onbeforeunload

Only change onbeforeunload when that option is set
pull/1430/head
Artur Arseniev 8 years ago
committed by GitHub
parent
commit
7c8680c00d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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