refactor index serialization
This commit is contained in:
parent
a9cb693318
commit
e9ac918775
13
main.js
13
main.js
|
@ -1126,7 +1126,7 @@ function createnote(title)
|
|||
header: indexheader(content)
|
||||
};
|
||||
metadata[guid] = item;
|
||||
localStorage.setItem("index", JSON.stringify(metadata));
|
||||
serializeindex()
|
||||
localStorage.setItem(guid, content);
|
||||
return guid;
|
||||
}
|
||||
|
@ -1811,7 +1811,7 @@ function serialize()
|
|||
item.header = indexheader(md.value);
|
||||
item.lastchanged = Date.now();
|
||||
|
||||
localStorage.setItem("index", JSON.stringify(metadata));
|
||||
serializeindex()
|
||||
localStorage.setItem(guid, md.value);
|
||||
}
|
||||
else if (title.value == "settings.json")
|
||||
|
@ -2375,18 +2375,23 @@ function restoredeleted()
|
|||
metadata[guid].deleted = false;
|
||||
metadata[guid].lastchanged = Date.now();
|
||||
renameinternallinks(title + " (deleted)", title);
|
||||
localStorage.setItem("index", JSON.stringify(metadata));
|
||||
serializeindex();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function serializeindex()
|
||||
{
|
||||
localStorage.setItem("index", JSON.stringify(metadata));
|
||||
}
|
||||
|
||||
function deletenote(title)
|
||||
{
|
||||
var guid = getguid(title);
|
||||
metadata[guid].deleted = true;
|
||||
metadata[guid].lastchanged = Date.now();
|
||||
renameinternallinks(title, title + " (deleted)");
|
||||
localStorage.setItem("index", JSON.stringify(metadata));
|
||||
serializeindex()
|
||||
}
|
||||
|
||||
function deletecurrentnote()
|
||||
|
|
Loading…
Reference in New Issue