 const contentsDiv = document.getElementById('contents');
    if(lastselectedidx >= db.length)
    {
        return;
    }
    let ebox = document.getElementById('editbox');
    if(ebox && ebox.value)
    {
        try {
            var newitem = JSON.parse(ebox.value);
            db[lastselectedidx] = newitem;
            contentsDiv.innerHTML = renderPage(db[lastselectedidx],true).text;
            contentsDiv.scrollTop = 0;
        } catch (e) {
            console.log("Error decoding text