fix reload of current note
This commit is contained in:
quenousimporte 2024-02-15 22:32:17 +01:00
parent a1c0033e26
commit e0a365b612
1 changed files with 9 additions and 6 deletions

15
main.js
View File

@ -356,6 +356,7 @@ function pushitem(key, value)
{
unsavedmark.hidden = false;
pending[key] = true;
var name = metadata[key] ? metadata[key].title : key;
encryptstring(value)
.then(encrypted =>
@ -364,13 +365,12 @@ function pushitem(key, value)
})
.then( () =>
{
console.log(key + " pushed to server");
console.log("'" + name + "' pushed to server");
delete pending[key];
})
.catch( err =>
{
var msg = "error while pushing '" + (metadata[key] ? metadata[key].title : key) + "': " + err;
console.error(msg);
console.error("error while pushing '" + name + "': " + err);
showtemporaryinfo(msg);
setTimeout( () =>
{
@ -1191,10 +1191,10 @@ function loadstorage()
}
var title = params.get("n") || params.get("name");
if (window.title.value)
if (document.title.value)
{
// reload current
loadnote(window.title.value);
loadnote(document.title.value);
}
else if (title)
{
@ -1336,10 +1336,13 @@ function pushall()
function fetchandserialize(guid)
{
var name = metadata[guid] ? metadata[guid] : guid;
console.log("fetching '" + name + "'");
return queryremote({action: "fetch", name: guid})
.then(content =>
{
localStorage.setItem(guid, content);
console.log("'" + name + "' fetched and serialized");
});
}
@ -1897,7 +1900,7 @@ function flush()
}
unsavedmark.hidden = Object.keys(pending).length == 0;
console.log("data serialized locally");
console.log("'" + title.value + "' serialized locally");
}
function escapeHtml(unsafe) {