Remove AutoSave Function on Submit

Remove automatic save function on submit of form to stop MDE resaving
the value as the submit is still occurring.
This stops the already submitted value being redisplayed on load which
improves the end user experience.
This commit is contained in:
Andrew Rawlinson-Bennett 2016-02-26 12:31:31 +00:00
parent 6318fc1b19
commit a6d958107b

View File

@ -1198,6 +1198,11 @@ SimpleMDE.prototype.autosave = function() {
if(simplemde.element.form != null && simplemde.element.form != undefined) { if(simplemde.element.form != null && simplemde.element.form != undefined) {
simplemde.element.form.addEventListener("submit", function() { simplemde.element.form.addEventListener("submit", function() {
/**
* Remove the autosave function to stop resaving the MDE after the
* submit has been started.
*/
SimpleMDE.prototype.autosave = function(){};
localStorage.removeItem("smde_" + simplemde.options.autosave.uniqueId); localStorage.removeItem("smde_" + simplemde.options.autosave.uniqueId);
}); });
} }