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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
4 deletions
-
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()) { |
|
|
|
|