Skip to content

Commit 2c603ff

Browse files
committed
do not prompt user to save on actual save
1 parent ff5204b commit 2c603ff

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/actions/views/editor/_editor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
endforeach;
4848
?>
4949
<li class="pull-right">
50-
<button class="btn btn-block btn-primary"><?= Yii::t('prototype', 'Save changes') ?></button>
50+
<button type="submit" id="save-changes" class="btn btn-block btn-primary"><?= Yii::t('prototype', 'Save changes') ?></button>
5151
</li>
5252
</ul>
5353
<div class="tab-content">

src/assets/web/editor/js/editor.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ $(function(){
3232
localStorage.setItem(localStorageKey, newActiveHash);
3333
});
3434

35+
$('#save-changes').on('click', function () {
36+
window.onbeforeunload = null
37+
});
38+
3539
// remember user to save stuff
36-
window.onbeforeunload = function() {
40+
window.onbeforeunload = function (e) {
3741
return true;
38-
};
42+
}
3943
});

0 commit comments

Comments
 (0)