'+list.map(h=>`
${h.id}${h.when} · ${h.size}
`).join('')+'
';
};
async function restore(id){
if(!confirm('用这份旧稿覆盖当前内容?')) return;
const r=await fetch('./api/restore',{method:'POST',headers:{'Content-Type':'application/json'},
body:JSON.stringify({p:PATH,id:id})});
const j=await r.json();
if(j.ok){ ta.value=j.text; dirty=true; toast('已载入旧稿,记得保存'); }
else toast('恢复失败');
}