2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-28 13:41:01 -06:00

Merge pull request #132 from Situphen/localstorage

Remove empty localStorage entries
This commit is contained in:
Jeroen Akkerman 2020-01-13 22:09:04 +01:00 committed by GitHub
commit c39b521cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 != '') {