Skip to content
Snippets Groups Projects
Commit 0b1dcbbf authored by Chris Lawton's avatar Chris Lawton
Browse files

warn the user of unsaved changes if they try to leave the page whilst editing a comment

parent 6e9b0c4d
No related branches found
No related tags found
No related merge requests found
...@@ -142,4 +142,11 @@ ...@@ -142,4 +142,11 @@
const hideError = () => $(commentError).remove(); const hideError = () => $(commentError).remove();
window.addEventListener('beforeunload', (e) => {
if ($(submitEditButton).length) {
e.preventDefault();
e.returnValue = 'It looks like you\'re still editing a comment. Are you sure you want to leave?';
}
});
})(jQuery); })(jQuery);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment