From 98ac206e1fed3c3becb7edd81c9979e63feb4d80 Mon Sep 17 00:00:00 2001 From: kim Date: Fri, 16 Oct 2026 14:17:53 +0900 Subject: [PATCH] =?UTF-8?q?detective-app:=20=EB=A9=94=EB=AA=A8=20=EB=B3=B4?= =?UTF-8?q?=EA=B8=B0=20=ED=99=94=EB=A9=B4=EC=9D=84=20md=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EC=B2=98=EB=9F=BC=20=EB=A0=8C=EB=8D=94=EB=A7=81=20(?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=C2=B7=EB=AA=A9=EB=A1=9D=C2=B7=EB=93=A4?= =?UTF-8?q?=EC=97=AC=EC=93=B0=EA=B8=B0=C2=B7=EB=B2=88=ED=98=B8=C2=B7?= =?UTF-8?q?=ED=95=AD=EB=AA=A9:=EA=B0=92=C2=B7=EC=9D=B8=EC=9A=A9=C2=B7?= =?UTF-8?q?=EB=A7=81=ED=81=AC=C2=B7=ED=91=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- web-ui/html/detective-app.html | 96 +++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/web-ui/html/detective-app.html b/web-ui/html/detective-app.html index 7161c53..334b3fd 100644 --- a/web-ui/html/detective-app.html +++ b/web-ui/html/detective-app.html @@ -93,12 +93,25 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;dis .dt-notes-textarea{flex:1;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:12px 14px;font-size:12px;color:var(--text);font-family:inherit;resize:none;outline:none;line-height:1.7;transition:.15s;} .dt-notes-textarea:focus{border-color:#3b82f6;} .dt-notes-textarea::placeholder{color:var(--muted);} -.dt-notes-view{flex:1;min-height:0;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:12px 14px;font-size:12px;color:var(--text);line-height:1.7;white-space:pre-wrap;word-break:keep-all;overflow-wrap:anywhere;cursor:text;} +.dt-notes-view{flex:1;min-height:0;overflow:auto;background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:12px 16px;font-size:12.5px;color:var(--text);line-height:1.75;word-break:keep-all;overflow-wrap:anywhere;cursor:text;} .dt-notes-view:hover{border-color:#3b82f6;} -.dt-notes-view table{border-collapse:collapse;font-size:11px;margin:6px 0;white-space:normal;width:100%;table-layout:auto;} +.dt-notes-view .nv-p{margin:0 0 8px;} +.dt-notes-view .nv-h{font-weight:700;margin:14px 0 6px;line-height:1.4;} +.dt-notes-view .nv-h1{font-size:16px;border-bottom:1px solid var(--line);padding-bottom:4px;} +.dt-notes-view .nv-h2{font-size:14px;color:#3b82f6;} +.dt-notes-view .nv-h3,.dt-notes-view .nv-h4{font-size:13px;} +.dt-notes-view .nv-li{display:flex;gap:7px;margin-bottom:3px;} +.dt-notes-view .nv-mk{flex:none;min-width:1.2em;text-align:right;color:var(--muted);} +.dt-notes-view .nv-kv{margin-bottom:3px;} +.dt-notes-view .nv-k{font-weight:700;color:var(--muted);margin-right:4px;} +.dt-notes-view .nv-cont{display:inline-block;margin-left:1.5em;} +.dt-notes-view .nv-q{border-left:3px solid var(--line);padding-left:10px;color:var(--muted);margin:4px 0;} +.dt-notes-view hr{border:none;border-top:1px solid var(--line);margin:12px 0;} +.dt-notes-view a{color:#3b82f6;} +.dt-notes-view table{border-collapse:collapse;font-size:11.5px;margin:8px 0;width:100%;table-layout:auto;} .dt-notes-view th,.dt-notes-view td{border:1px solid var(--line);padding:4px 8px;text-align:left;vertical-align:top;line-height:1.55;word-break:keep-all;overflow-wrap:anywhere;} -.dt-notes-view td:first-child{white-space:nowrap;} .dt-notes-view th{background:var(--panel-2);font-weight:700;} +.dt-notes-view td:first-child{white-space:nowrap;} .dt-notes-view code{background:var(--panel-2);padding:0 4px;border-radius:3px;} .dt-notes-hint{font-size:10px;color:var(--muted);margin-left:8px;font-weight:400;} @@ -377,7 +390,7 @@ body{background:var(--bg);color:var(--text);font-family:system-ui,sans-serif;dis - 확인된 사실: 2024년 법인 설립, 주소지 ○○동 - 의심 정황: SNS에서 확인되지 않은 수익 주장 - 수집 단서: 사업자등록증 번호, 전화번호 ○○○" oninput="onNotesChange()" onblur="saveCases();refreshNotesView()" onkeydown="handleNotesTab(event)"> - + @@ -947,29 +960,76 @@ function notesTabsToMd(raw){ } return out.join('\n'); } -// 복사해 온 글은 일정 폭에서 줄이 하드 개행돼 있어, 화면이 좁으면 둘째 줄이 짧게 남는다. -// 보기 화면에서만: 긴 줄(45자↑) 뒤에 이어지는 일반 문장 줄은 한 줄로 이어 붙여 화면 폭에 맞게 다시 흘린다. -function notesReflow(text){ - const lines=text.split('\n'),out=[]; - const special=l=>/^\s*(\||[-*•·▪]\s|\d+[.)]\s|\[|#|>|[가-힣A-Za-z0-9 ]{1,12}\s*:\s)/.test(l); - for(const l of lines){ - const prev=out.length?out[out.length-1]:null; - if(prev!==null&&prev.trim()&&l.trim()&&prev.trim().length>=45&&!special(prev)&&!special(l))out[out.length-1]=prev.replace(/\s+$/,'')+' '+l.trim(); - else out.push(l); +// 메모 보기 화면: md 문서처럼 정리해서 보여준다(표시용일 뿐, 저장된 원문은 그대로). +// 제목(#, [제목]), 목록(-, *, •, 1., 1), 가., (1)) 들여쓰기 단계, "항목 : 값", 인용(>), 구분선, 표(| 또는 탭), +// 굵게/코드/링크를 처리하고, 하드 개행된 긴 문장(45자↑)은 이어 붙여 화면 폭에 맞춘다. +function notesRender(raw){ + const esc=t=>t.replace(/&/g,'&').replace(//g,'>'); + const inl=t=>t.replace(/`([^`]+)`/g,'$1').replace(/\*\*(.+?)\*\*/g,'$1') + .replace(/(https?:\/\/[^\s<)]+)/g,'$1'); + const indentOf=l=>{let n=0;for(const ch of l){if(ch==='\t')n+=4;else if(ch===' ')n++;else break;}return n;}; + const LI=/^(\s*)([-*•·▪‣◦○●■□→]|\d+[.)]|\(\d+\)|[가-힣][.)])\s+(.*)$/; + const lines=notesTabsToMd(raw).split('\n'); + const out=[];let i=0,para=null; + const flush=()=>{if(para){out.push('
'+para.join('
')+'
');para=null;}}; + const pushText=(html,rawLine)=>{ + if(para&¶.length&&rawLine&¶.prevRaw&¶.prevRaw.trim().length>=45&&!LI.test(rawLine)&&!/^\s*\[/.test(rawLine)&&!/^\s*[^\s:]{1,12}\s*:\s/.test(rawLine)){ + para[para.length-1]+=' '+html; + }else{(para=para||[]).push(html);} + para.prevRaw=rawLine; + }; + while(i$1').replace(/\*\*(.+?)\*\*/g,'$1')); + i=j;continue; + } + let m; + if(/^\s*(-{3,}|={3,}|_{3,}|─{3,})\s*$/.test(l)){flush();out.push('
');i++;continue;} + if((m=l.match(/^\s*(#{1,4})\s+(.+)$/))){flush();out.push(`
${inl(esc(m[2]))}
`);i++;continue;} + if((m=l.match(/^\s*\[([^\]]{1,40})\]\s*$/))){flush();out.push(`
${esc(m[1])}
`);i++;continue;} + if((m=l.match(/^\s*>\s?(.*)$/))){flush();out.push(`
${inl(esc(m[1]))}
`);i++;continue;} + if((m=l.match(LI))){ + flush();const lvl=Math.min(Math.floor(indentOf(m[1])/2),6); + let marker=m[2],body=m[3]; + if(/^[-*·▪‣◦○●■□→]$/.test(marker))marker=lvl%2?'◦':'•'; + let html=inl(esc(body)),last=l; + // 목록 항목 바로 아래 더 깊게 들여쓴 일반 줄 = 같은 항목의 이어지는 내용 + while(i+1indentOf(l)&&!/^\s*[|#>]/.test(lines[i+1])){ + i++;html+=(last.trim().length>=45?' ':'
')+inl(esc(lines[i].trim()));last=lines[i]; + } + out.push(`
${esc(marker)}${html}
`); + i++;continue; + } + // "항목 : 값" + if((m=l.match(/^(\s*)([^\s:|][^:|]{0,11}?)\s*:\s+(.*)$/))&&!/https?$/.test(m[2])){ + flush();let html=`${esc(m[2].trim())} ${inl(esc(m[3]))}`; + while(i+1=4&&!LI.test(lines[i+1])&&!/^\s*[|#>]/.test(lines[i+1])){ + i++;html+='
'+inl(esc(lines[i].trim()))+''; + } + out.push(`
${html}
`);i++;continue; + } + // 일반 줄 (들여쓴 줄은 들여쓰기 유지) + const ind=indentOf(l); + if(ind>=4){flush();out.push(`
${inl(esc(l.trim()))}
`);i++;continue;} + pushText(inl(esc(l.trim())),l);i++; } - return out.join('\n'); + flush(); + return out.join(''); } function refreshNotesView(){ const ta=document.getElementById('case-notes'),view=document.getElementById('case-notes-view'); if(!ta||!view)return; const raw0=ta.value||''; if(!raw0.trim()||document.activeElement===ta){view.style.display='none';ta.style.display='';return;} - const raw=notesReflow(notesTabsToMd(raw0)); - const esc=raw.replace(/&/g,'&').replace(//g,'>'); - view.innerHTML=mdTables(esc).replace(/`([^`]+)`/g,'$1').replace(/\*\*(.+?)\*\*/g,'$1').replace(/(<\/table><\/div>)\n/g,'$1'); + view.innerHTML=notesRender(raw0); ta.style.display='none';view.style.display=''; } -function editNotes(){ +function editNotes(ev){ + if(ev&&ev.target&&ev.target.closest&&ev.target.closest('a'))return; // 링크 클릭은 편집 전환 안 함 const ta=document.getElementById('case-notes'),view=document.getElementById('case-notes-view'); if(window.getSelection&&String(window.getSelection()))return; // 드래그 선택(복사) 중이면 편집 전환 안 함 view.style.display='none';ta.style.display='';ta.focus();