Fix an issue where editing markdown on mobile wouldn't enable the submit button, and refresh the editor correctly

This commit is contained in:
Kevin MacMartin 2018-01-21 23:07:21 -05:00
parent 45e84497f1
commit 486738d0a7

View file

@ -450,6 +450,11 @@ function editItemInit() {
} }
}; };
const contentChanged = function() {
changes = true;
$submit.removeClass("disabled");
};
$(".edit-button.delete.image").on("click", function(e) { $(".edit-button.delete.image").on("click", function(e) {
const $this = $(this), const $this = $(this),
name = $this.data("name"); name = $this.data("name");
@ -564,15 +569,13 @@ function editItemInit() {
setTimeout(function() { setTimeout(function() {
simplemde[column].value($this.attr("value")); simplemde[column].value($this.attr("value"));
simplemde[column].refresh(); simplemde[column].codemirror.refresh();
simplemde[column].codemirror.on("change", contentChanged);
}, 500); }, 500);
}); });
// initialize change events for back button // initialize change events for back button
$editItem.find("input, textarea, select").on("input change", function() { $editItem.find("input, select").on("input change", contentChanged);
changes = true;
$submit.removeClass("disabled");
});
// initialize back button // initialize back button
$backButton.on("click", function() { $backButton.on("click", function() {