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)
|
header: indexheader(content)
|
||||||
};
|
};
|
||||||
metadata[guid] = item;
|
metadata[guid] = item;
|
||||||
localStorage.setItem("index", JSON.stringify(metadata));
|
serializeindex()
|
||||||
localStorage.setItem(guid, content);
|
localStorage.setItem(guid, content);
|
||||||
return guid;
|
return guid;
|
||||||
}
|
}
|
||||||
|
@ -1811,7 +1811,7 @@ function serialize()
|
||||||
item.header = indexheader(md.value);
|
item.header = indexheader(md.value);
|
||||||
item.lastchanged = Date.now();
|
item.lastchanged = Date.now();
|
||||||
|
|
||||||
localStorage.setItem("index", JSON.stringify(metadata));
|
serializeindex()
|
||||||
localStorage.setItem(guid, md.value);
|
localStorage.setItem(guid, md.value);
|
||||||
}
|
}
|
||||||
else if (title.value == "settings.json")
|
else if (title.value == "settings.json")
|
||||||
|
@ -2375,18 +2375,23 @@ function restoredeleted()
|
||||||
metadata[guid].deleted = false;
|
metadata[guid].deleted = false;
|
||||||
metadata[guid].lastchanged = Date.now();
|
metadata[guid].lastchanged = Date.now();
|
||||||
renameinternallinks(title + " (deleted)", title);
|
renameinternallinks(title + " (deleted)", title);
|
||||||
localStorage.setItem("index", JSON.stringify(metadata));
|
serializeindex();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializeindex()
|
||||||
|
{
|
||||||
|
localStorage.setItem("index", JSON.stringify(metadata));
|
||||||
|
}
|
||||||
|
|
||||||
function deletenote(title)
|
function deletenote(title)
|
||||||
{
|
{
|
||||||
var guid = getguid(title);
|
var guid = getguid(title);
|
||||||
metadata[guid].deleted = true;
|
metadata[guid].deleted = true;
|
||||||
metadata[guid].lastchanged = Date.now();
|
metadata[guid].lastchanged = Date.now();
|
||||||
renameinternallinks(title, title + " (deleted)");
|
renameinternallinks(title, title + " (deleted)");
|
||||||
localStorage.setItem("index", JSON.stringify(metadata));
|
serializeindex()
|
||||||
}
|
}
|
||||||
|
|
||||||
function deletecurrentnote()
|
function deletecurrentnote()
|
||||||
|
|
Loading…
Reference in New Issue