v4.3.41: 법률 앱 사건 목록에서 이름 바로 편집

사이드바 사건 목록에서 ✎ 버튼으로 바로 이름 변경 가능하게 추가 (헤더까지
안 들어가도 됨). 처음엔 더블클릭 방식으로 짰다가 실제 클릭으로 테스트하니
안 먹혀서 원인을 봤더니 — 더블클릭은 실제로 click·click·dblclick 순으로
발생하는데, 앞의 두 click이 부모(사건 선택)로 버블링되면서 목록을
통째로 다시 그려버려 dblclick 핸들러가 붙어있던 엘리먼트가 바뀌는
경쟁 상태였음. 더블클릭 대신 별도 버튼(단일 클릭 + stopPropagation)으로
바꿔서 해결.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
kim
2026-07-30 19:02:52 +09:00
co-authored by Claude Opus 5
parent 9d76a0d7e9
commit dd7a1d0ca1
+43 -1
View File
@@ -183,11 +183,14 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;dis
.lw-case-item{padding:7px 10px;border-radius:7px;border:1px solid transparent;cursor:pointer;margin-bottom:2px;transition:.12s;position:relative;}
.lw-case-item:hover{background:rgba(234,179,8,.05);border-color:rgba(234,179,8,.2);}
.lw-case-item.active{background:rgba(234,179,8,.1);border-color:rgba(234,179,8,.35);}
.lw-case-title{font-size:12px;font-weight:600;color:var(--text);margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:18px;}
.lw-case-title{font-size:12px;font-weight:600;color:var(--text);margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:34px;}
.lw-case-meta{font-size:10px;color:var(--muted);display:flex;align-items:center;gap:4px;flex-wrap:wrap;}
.lw-case-del{position:absolute;top:6px;right:6px;background:none;border:none;cursor:pointer;font-size:12px;color:var(--muted);opacity:0;transition:.12s;padding:1px 3px;}
.lw-case-item:hover .lw-case-del{opacity:.6;}
.lw-case-del:hover{opacity:1 !important;color:#ef4444;}
.lw-case-rename{position:absolute;top:6px;right:22px;background:none;border:none;cursor:pointer;font-size:11px;color:var(--muted);opacity:0;transition:.12s;padding:1px 3px;}
.lw-case-item:hover .lw-case-rename{opacity:.6;}
.lw-case-rename:hover{opacity:1 !important;color:#eab308;}
.lw-status-dot{display:inline-block;width:6px;height:6px;border-radius:50%;margin-right:2px;vertical-align:middle;flex-shrink:0;}
.s-active{background:#22c55e;}.s-done{background:#3b82f6;}.s-hold{background:#f59e0b;}
.lw-pri-dot{display:inline-block;width:5px;height:5px;border-radius:50%;vertical-align:middle;flex-shrink:0;}
@@ -789,11 +792,50 @@ function renderCaseList(){
${date?'· '+date:''}
${clTotal?`<span style="color:var(--muted)">✅${clDone}/${clTotal}</span>`:''}
</div>
<button class="lw-case-rename" onclick="event.stopPropagation();startRenameCase('${c.id}',this)" title="이름 변경">✎</button>
<button class="lw-case-del" onclick="event.stopPropagation();deleteCase('${c.id}')" title="삭제">✕</button>
</div>`;
}).join('');
}
// Double-click a case's title in the sidebar list to rename it inline, without
// having to select the case first and edit the header input — swaps the title
// div for a text input, commits on Enter/blur, discards on Escape.
// btnOrTitleEl: the rename (✎) button that was clicked — looked up via
// closest() rather than a fixed sibling reference so markup order can change
// without breaking this.
function startRenameCase(id,btnOrTitleEl){
const c=cases.find(x=>x.id===id);
if(!c)return;
const titleEl=btnOrTitleEl.classList.contains('lw-case-title')?btnOrTitleEl:btnOrTitleEl.closest('.lw-case-item').querySelector('.lw-case-title');
if(!titleEl)return;
const input=document.createElement('input');
input.className='lw-case-title';
input.style.cssText='width:100%;box-sizing:border-box;background:var(--panel-2);border:1px solid #eab308;border-radius:4px;padding:1px 4px;font:inherit;color:inherit;';
input.value=c.title||'';
const commit=()=>{
const name=input.value.trim();
if(name){
c.title=name;
if(currentCaseId===id){
document.getElementById('case-name-input').value=name;
const label=document.getElementById('lw-chat-ctx-label');
if(label)label.textContent=name;
}
saveCases();
}
renderCaseList();
};
input.onblur=commit;
input.onkeydown=(e)=>{
if(e.key==='Enter'){e.preventDefault();input.blur();}
else if(e.key==='Escape'){e.preventDefault();input.onblur=null;renderCaseList();}
};
input.onclick=(e)=>e.stopPropagation();
titleEl.replaceWith(input);
input.focus();input.select();
}
function selectCase(id){
updateCurrentCaseFromDom();
currentCaseId=id;