Hide unsaved changes warning after undoing them
This way showing the warning is consistent with warning users when they're leaving the page.
This commit is contained in:
@@ -22,8 +22,18 @@
|
||||
});
|
||||
editor = $(this);
|
||||
editor.on("input", function() {
|
||||
var textarea, warning;
|
||||
|
||||
textarea = editor.find("textarea")[0];
|
||||
warning = $(this).closest(".translatable-fields").find(".warning");
|
||||
|
||||
App.MarkdownEditor.refresh_preview($(this), md);
|
||||
$(".legislation-draft-versions-edit .warning").show();
|
||||
|
||||
if (textarea.value === textarea.defaultValue) {
|
||||
warning.hide();
|
||||
} else {
|
||||
warning.show();
|
||||
}
|
||||
});
|
||||
editor.find("textarea").on("scroll", function() {
|
||||
editor.find(".markdown-preview").scrollTop($(this).scrollTop());
|
||||
|
||||
Reference in New Issue
Block a user