Fix family publishing, concurrent edits and session consistency

This commit is contained in:
Codex
2026-10-03 20:27:11 +08:00
parent 80f8bd72af
commit 56a24c80e2
12 changed files with 210 additions and 38 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ class FamilyMap {
reset(){this.key='';this.data=null;this.viewport.replaceChildren();this.autoFit=true;this.drag=null;$('#family-zoom-value').textContent='100%';}
render(data) {
this.data=data;
const key=JSON.stringify([data.people,data.links,data.showArchived]);
const key=JSON.stringify([data.people,data.links,data.showArchived,data.selfId]);
if(key!==this.key) {
this.key=key;this.graph=ZhaoFamilyGraph.layout(data.people,data.links,data);
const g=this.graph;
@@ -30,7 +30,7 @@ class FamilyMap {
this.viewport.querySelectorAll('[data-map-person]').forEach(b=>{
const p=byId.get(b.dataset.mapPerson),self=p.id===data.selfId,selected=p.id===data.focusId;
const matched=data.term&&[p.name,p.alias,p.birthplace].join(' ').toLowerCase().includes(data.term);
const relation=ZhaoKinship.describe(data.people,data.links,data.reference,p.id);
const relation=p.id===data.reference&&!self?'参照人物':ZhaoKinship.describe(data.people,data.links,data.reference,p.id);
b.classList.toggle('self',self);b.classList.toggle('selected',selected);b.classList.toggle('search-hit',!!matched);b.classList.toggle('archived',!!p.archived);
b.setAttribute('aria-pressed',String(selected));b.setAttribute('aria-label',p.name+(self?',本人':'')+','+relation+',查看人物档案');
b.title=p.name+' · '+relation+(p.archived?' · 已归档':'');