diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 2c66604c0..9f5d0f778 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -137,10 +137,8 @@ module.exports = Backbone.Model.extend({ const stm = this.get('StorageManager'); const changes = this.get('changesCount'); - if (this.config.noticeOnUnload && changes) { - window.onbeforeunload = e => 1; - } else { - window.onbeforeunload = null; + if (this.config.noticeOnUnload) { + window.onbeforeunload = changes ? e => 1 : null; } if (stm.isAutosave() && changes >= stm.getStepsBeforeSave()) {