mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-02 23:54:28 -06:00
Merge pull request #2 from adamb70/fix-autosave-submit-handler
Update src/js/easymde.js
This commit is contained in:
commit
613fb0fcad
@ -1656,10 +1656,22 @@ EasyMDE.prototype.autosave = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
if (easyMDE.element.form != null && easyMDE.element.form != undefined) {
|
||||
easyMDE.element.form.addEventListener('submit', function () {
|
||||
localStorage.removeItem('smde_' + easyMDE.options.autosave.uniqueId);
|
||||
});
|
||||
if(this.options.autosave.binded !== true) {
|
||||
if (easyMDE.element.form != null && easyMDE.element.form != undefined) {
|
||||
easyMDE.element.form.addEventListener('submit', function () {
|
||||
clearTimeout(easyMDE.autosaveTimeoutId);
|
||||
easyMDE.autosaveTimeoutId = undefined;
|
||||
|
||||
localStorage.removeItem('smde_' + easyMDE.options.autosave.uniqueId);
|
||||
|
||||
// Restart autosaving in case the submit will be cancelled down the line
|
||||
setTimeout(function() {
|
||||
easyMDE.autosave();
|
||||
}, 10000);
|
||||
});
|
||||
}
|
||||
|
||||
this.options.autosave.binded = true;
|
||||
}
|
||||
|
||||
if (this.options.autosave.loaded !== true) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user