Attach unsaved changes warning to trigger only after changes are made
This commit is contained in:
@@ -214,14 +214,18 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
if( $('#wiki-wrapper.edit').length ){
|
||||
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
||||
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
||||
$("#gollum-editor-body").one('change', function(){
|
||||
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
||||
});
|
||||
$.GollumEditor();
|
||||
}
|
||||
|
||||
if( $('#wiki-wrapper.create').length ){
|
||||
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
|
||||
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
||||
$("#gollum-editor-body").one('change', function(){
|
||||
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
|
||||
)};
|
||||
$.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user