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 ){
|
if( $('#wiki-wrapper.edit').length ){
|
||||||
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
|
||||||
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
|
||||||
|
$("#gollum-editor-body").one('change', function(){
|
||||||
|
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
|
||||||
|
});
|
||||||
$.GollumEditor();
|
$.GollumEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( $('#wiki-wrapper.create').length ){
|
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-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}}' });
|
$.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user