2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-24 10:24:29 -06:00

Remove empty localStorage entries

This commit is contained in:
Situphen 2019-11-20 14:49:03 +01:00
parent a49da28f4d
commit ef213175ce

View File

@ -1945,7 +1945,12 @@ EasyMDE.prototype.autosave = function () {
this.options.autosave.loaded = true;
}
localStorage.setItem('smde_' + this.options.autosave.uniqueId, easyMDE.value());
var value = easyMDE.value();
if (value !== '') {
localStorage.setItem('smde_' + this.options.autosave.uniqueId, value);
} else {
localStorage.removeItem('smde_' + this.options.autosave.uniqueId);
}
var el = document.getElementById('autosaved');
if (el != null && el != undefined && el != '') {