|
|
|
@ -1601,12 +1601,24 @@ SimpleMDE.prototype.autosave = function() {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.options.autosave.binded !== true) {
|
|
|
|
|
if(simplemde.element.form != null && simplemde.element.form != undefined) {
|
|
|
|
|
simplemde.element.form.addEventListener("submit", function() {
|
|
|
|
|
clearTimeout(simplemde.autosaveTimeoutId);
|
|
|
|
|
simplemde.autosaveTimeoutId = undefined;
|
|
|
|
|
|
|
|
|
|
localStorage.removeItem("smde_" + simplemde.options.autosave.uniqueId);
|
|
|
|
|
|
|
|
|
|
// Restart autosaving in case the submit will be cancelled down the line
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
simplemde.autosave();
|
|
|
|
|
}, 10000);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.options.autosave.binded = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(this.options.autosave.loaded !== true) {
|
|
|
|
|
if(typeof localStorage.getItem("smde_" + this.options.autosave.uniqueId) == "string" && localStorage.getItem("smde_" + this.options.autosave.uniqueId) != "") {
|
|
|
|
|
this.codemirror.setValue(localStorage.getItem("smde_" + this.options.autosave.uniqueId));
|
|
|
|
|