mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-19 07:54:28 -06:00
commit
604f2c8ea9
@ -1657,12 +1657,24 @@ EasyMDE.prototype.autosave = function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.options.autosave.binded !== true) {
|
||||||
if (easyMDE.element.form != null && easyMDE.element.form != undefined) {
|
if (easyMDE.element.form != null && easyMDE.element.form != undefined) {
|
||||||
easyMDE.element.form.addEventListener('submit', function () {
|
easyMDE.element.form.addEventListener('submit', function () {
|
||||||
|
clearTimeout(easyMDE.autosaveTimeoutId);
|
||||||
|
easyMDE.autosaveTimeoutId = undefined;
|
||||||
|
|
||||||
localStorage.removeItem('smde_' + easyMDE.options.autosave.uniqueId);
|
localStorage.removeItem('smde_' + easyMDE.options.autosave.uniqueId);
|
||||||
|
|
||||||
|
// Restart autosaving in case the submit will be cancelled down the line
|
||||||
|
setTimeout(function() {
|
||||||
|
easyMDE.autosave();
|
||||||
|
}, easyMDE.options.autosave.delay || 10000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.options.autosave.binded = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.options.autosave.loaded !== true) {
|
if (this.options.autosave.loaded !== true) {
|
||||||
if (typeof localStorage.getItem('smde_' + this.options.autosave.uniqueId) == 'string' && localStorage.getItem('smde_' + this.options.autosave.uniqueId) != '') {
|
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));
|
this.codemirror.setValue(localStorage.getItem('smde_' + this.options.autosave.uniqueId));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user