feat(project): 설명란 이미지 더블클릭 = 별도 창 보기, 댓글 Shift+Enter 줄바꿈, 메뉴 이름 Project

- 설명란 이미지 더블클릭 → 별도 브라우저 창(원본 크기, 휠 확대·축소, 끌어서 이동, −/+ · 1:1 · 맞춤 막대, 키 + − 0 1 Esc)
- 댓글 입력칸·댓글 대화창·답글 입력칸을 여러 줄 입력칸으로 — Enter 등록, Shift+Enter 줄바꿈, 줄 수만큼 늘어남
- ERP 메뉴·홈 카드 이름 "프로젝트 관리" → "Project"
- project.css/js 캐시 버전 올림

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 10:50:30 +09:00
parent e1006c63de
commit a3a9444c3b
11 changed files with 118 additions and 19 deletions
+93 -6
View File
@@ -1895,6 +1895,7 @@
pendingErrors = new WeakMap();
renderPending();
inp.value = "";
fitComposer(inp);
clearMentions(inp);
if (res && res.mention_skipped && res.mention_skipped.length) {
showToast("태그하지 못한 사람(이 작업을 볼 수 없음): " + res.mention_skipped.map(idOf).join(", "), "error");
@@ -1920,7 +1921,7 @@
el("pj-cm-input").addEventListener("input", function () { chatToken = null; });
el("pj-cm-input").addEventListener("keydown", function (e) {
if (isImeEnter(e)) return; // 한글 조합 확정 Enter 는 전송하지 않는다
if (e.key === "Enter") { e.preventDefault(); el("pj-cm-send").click(); }
if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); el("pj-cm-send").click(); } // Shift+Enter = 줄바꿈
});
cmtChat = { open: open, wireBadge: wireBadge };
@@ -2068,6 +2069,85 @@
return false;
}
// ── 이미지 보기 창 — 설명란 이미지를 더블클릭하면 별도 브라우저 창(팝업 창, 페이지 안 팝업 아님)으로 연다.
// 창 크기 = 이미지 원본 크기(+ 여백·도구 막대), 화면보다 크면 화면 95% 까지. 처음엔 원본(100%), 창보다 크면 창에 맞춤.
// 창 안: 휠 = 마우스 위치 기준 확대·축소, 끌기 = 이동, 아래 막대 − / % / + · 1:1(원본) · 맞춤,
// 더블클릭 = 원본 ↔ 맞춤, 키보드 + − 0(맞춤) 1(원본). 이미지는 같은 서버 첨부 주소라 로그인 쿠키로 그대로 열린다.
function openImageWindow(img) {
const src = new URL(img.getAttribute("src") || img.src, location.href).href;
const nw = img.naturalWidth || 1200, nh = img.naturalHeight || 800;
const sw = (window.screen && screen.availWidth) || 1600, sh = (window.screen && screen.availHeight) || 900;
const w = Math.round(Math.min(Math.max(nw + 48, 480), sw * 0.95));
const h = Math.round(Math.min(Math.max(nh + 110, 360), sh * 0.95));
const left = Math.round(((window.screenX || 0) + Math.max(0, (window.outerWidth - w) / 2)));
const top = Math.round(((window.screenY || 0) + Math.max(0, (window.outerHeight - h) / 2)));
const win = window.open("", "pj-img-" + Date.now(),
"popup=yes,width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + ",resizable=yes,scrollbars=no");
if (!win) { showToast("팝업이 막혀 있습니다. 브라우저 주소창 오른쪽에서 이 사이트의 팝업을 허용해 주세요.", "error"); return; }
const title = (img.getAttribute("alt") || "").trim() || decodeURIComponent((src.split("?")[0].split("/").pop() || "이미지"));
const ICON = function (d) {
return '<svg viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round">' + d + "</svg>";
};
const html = '<!doctype html><html lang="ko"><head><meta charset="utf-8"><title>이미지</title>' +
'<meta name="viewport" content="width=device-width, initial-scale=1"><style>' +
'html,body{margin:0;height:100%;overflow:hidden;background:#202226;color:#fff;font-family:"Malgun Gothic","Apple SD Gothic Neo",system-ui,sans-serif}' +
'#stage{position:fixed;inset:0;cursor:grab;touch-action:none}#stage.drag{cursor:grabbing}' +
'#img{position:absolute;left:0;top:0;transform-origin:0 0;user-select:none;-webkit-user-drag:none;box-shadow:0 6px 28px rgba(0,0,0,.45);background:#fff;max-width:none}' +
'#bar{position:fixed;left:50%;bottom:14px;transform:translateX(-50%);display:flex;align-items:center;gap:2px;padding:4px;' +
'background:rgba(40,42,47,.92);border:1px solid rgba(255,255,255,.08);border-radius:10px;box-shadow:0 6px 18px rgba(0,0,0,.35);z-index:2}' +
'#bar button{height:30px;min-width:34px;padding:0 8px;border:0;border-radius:7px;background:transparent;color:#fff;cursor:pointer;' +
'display:inline-flex;align-items:center;justify-content:center;font-family:inherit;font-weight:600;font-size:12.5px}' +
'#bar button:hover{background:rgba(255,255,255,.14)}#bar button:focus-visible{outline:2px solid #9d8cff;outline-offset:1px}' +
'#pct{min-width:56px;text-align:center;font-size:13px;font-variant-numeric:tabular-nums}' +
'.sep{width:1px;height:18px;background:rgba(255,255,255,.18);margin:0 4px}' +
'#err{position:fixed;inset:0;display:none;align-items:center;justify-content:center;color:#cfd3da;font-size:14px}' +
'</style></head><body><div id="stage"><img id="img" alt="" draggable="false"></div><div id="err">이미지를 불러오지 못했습니다.</div>' +
'<div id="bar">' +
'<button id="out" title="축소 (−)" aria-label="축소">' + ICON('<path d="M5 10h10"/>') + "</button>" +
'<span id="pct">100%</span>' +
'<button id="in" title="확대 (+)" aria-label="확대">' + ICON('<path d="M5 10h10M10 5v10"/>') + "</button>" +
'<span class="sep"></span><button id="one" title="원본 크기 (1)">1:1</button><button id="fit" title="창에 맞춤 (0)">맞춤</button></div>' +
"<script>(function(){" +
"var SRC=" + JSON.stringify(src) + ",TITLE=" + JSON.stringify(title) + ";document.title=TITLE;" +
"var img=document.getElementById('img'),stage=document.getElementById('stage'),pct=document.getElementById('pct');" +
"var s=1,x=0,y=0,MIN=0.05,MAX=16,BAR=60;" +
"function apply(){img.style.transform='translate('+x+'px,'+y+'px) scale('+s+')';pct.textContent=Math.round(s*100)+'%';}" +
"function zoomAt(n,cx,cy){n=Math.min(MAX,Math.max(MIN,n));x=cx-(cx-x)*n/s;y=cy-(cy-y)*n/s;s=n;apply();}" +
"function centerAt(n){s=n;x=(innerWidth-img.naturalWidth*s)/2;y=(innerHeight-BAR-img.naturalHeight*s)/2+4;if(y<8)y=8;apply();}" +
"function fitScale(){return Math.min((innerWidth-32)/img.naturalWidth,(innerHeight-BAR-24)/img.naturalHeight);}" +
"img.onload=function(){var f=fitScale();centerAt(f<1?f:1);};" +
"img.onerror=function(){document.getElementById('err').style.display='flex';};img.src=SRC;" +
"stage.addEventListener('wheel',function(e){e.preventDefault();zoomAt(s*Math.exp(-e.deltaY*0.0015),e.clientX,e.clientY);},{passive:false});" +
"var drag=null;stage.addEventListener('pointerdown',function(e){if(e.button!==0)return;drag={x:e.clientX,y:e.clientY,ox:x,oy:y};stage.setPointerCapture(e.pointerId);stage.classList.add('drag');});" +
"stage.addEventListener('pointermove',function(e){if(!drag)return;x=drag.ox+e.clientX-drag.x;y=drag.oy+e.clientY-drag.y;apply();});" +
"function end(){drag=null;stage.classList.remove('drag');}stage.addEventListener('pointerup',end);stage.addEventListener('pointercancel',end);" +
"stage.addEventListener('dblclick',function(e){if(Math.abs(s-1)<0.01){centerAt(fitScale());}else{zoomAt(1,e.clientX,e.clientY);}});" +
"function mid(){return [innerWidth/2,(innerHeight-BAR)/2];}" +
"document.getElementById('in').onclick=function(){var m=mid();zoomAt(s*1.25,m[0],m[1]);};" +
"document.getElementById('out').onclick=function(){var m=mid();zoomAt(s/1.25,m[0],m[1]);};" +
"document.getElementById('one').onclick=function(){centerAt(1);};" +
"document.getElementById('fit').onclick=function(){centerAt(fitScale());};" +
"addEventListener('keydown',function(e){var m=mid();if(e.key==='+'||e.key==='='){zoomAt(s*1.25,m[0],m[1]);}else if(e.key==='-'||e.key==='_'){zoomAt(s/1.25,m[0],m[1]);}" +
"else if(e.key==='0'){centerAt(fitScale());}else if(e.key==='1'){centerAt(1);}else if(e.key==='Escape'){window.close();}});" +
"})();<\/script></body></html>";
win.document.open();
win.document.write(html);
win.document.close();
try { win.focus(); } catch (_) {}
}
// ── 댓글·답글 입력칸(textarea.pj-composer-ta) — 글 줄 수만큼 높이를 늘린다(최대 160px, 넘으면 칸 안 스크롤).
// Enter = 등록, Shift+Enter = 줄바꿈(각 입력칸 keydown). 코드로 비운 뒤엔 fitComposer 를 불러 한 줄로 되돌린다.
function fitComposer(ta) {
if (!ta || ta.tagName !== "TEXTAREA") return;
ta.style.height = "auto";
ta.style.height = Math.min(ta.scrollHeight, 160) + "px";
ta.style.overflowY = ta.scrollHeight > 160 ? "auto" : "hidden";
}
document.addEventListener("input", function (e) {
if (e.target && e.target.classList && e.target.classList.contains("pj-composer-ta")) fitComposer(e.target);
});
// ── 평문 input 용 (#pj-comment-input, #pj-cm-input) ──
// 고른 사람을 input 에 기억해두고(_pjMentions), 전송 직전에 "@아이디" 가
// 아직 본문에 남아 있는 사람만 서버로 보낸다.
@@ -6348,10 +6428,10 @@
if (!form) {
form = document.createElement("div");
form.className = "pj-comment-form pj-reply-form";
form.innerHTML = '<input type="text" placeholder="답글 입력…" />' +
form.innerHTML = '<textarea class="pj-composer-ta" rows="1" placeholder="답글 입력… (Shift+Enter 줄바꿈)"></textarea>' +
'<button type="button" class="pj-btn pj-btn-primary">답글</button>';
box.appendChild(form);
const inp = form.querySelector("input");
const inp = form.querySelector("textarea");
attachMentionInput(inp);
attachEmojiPicker(inp);
attachMentionButton(inp);
@@ -6381,11 +6461,11 @@
inp.addEventListener("input", function () { replyToken = null; });
inp.addEventListener("keydown", function (e) {
if (isImeEnter(e)) return;
if (e.key === "Enter") { e.preventDefault(); send(); }
if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); send(); } // Shift+Enter = 줄바꿈
else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); form.remove(); }
});
}
const inp = form.querySelector("input");
const inp = form.querySelector("textarea");
const author = (target.author_email || "").toLowerCase();
if (target.parent_id && author && author !== me && !inp.value) {
const token = "@" + idOf(author);
@@ -6449,6 +6529,7 @@
commentToken = null;
if (gen !== taskGen) return; // 그 사이 다른 작업 창 — 그 창의 입력칸을 비우지 않는다
inp.value = "";
fitComposer(inp);
clearMentions(inp);
loadComments(taskId);
if (res.mention_skipped && res.mention_skipped.length) warnMentionSkipped(res.mention_skipped);
@@ -6472,7 +6553,7 @@
el("pj-comment-input").addEventListener("input", function () { commentToken = null; }); // 내용이 바뀌면 새 댓글
el("pj-comment-input").addEventListener("keydown", function (e) {
if (isImeEnter(e)) return; // 한글 조합 확정 Enter 는 전송하지 않는다
if (e.key === "Enter") { e.preventDefault(); sendComment(); }
if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); sendComment(); } // Shift+Enter = 줄바꿈
});
const newTaskBtn = el("pj-new-task");
@@ -6965,6 +7046,12 @@
if (selectedImg) { selectedImg.classList.add("pj-img-selected"); positionImgTools(); }
else { imgTools.hidden = true; }
}
// 이미지 더블클릭 → 별도 브라우저 창에서 원본 크기로(확대·축소·끌어서 이동) — openImageWindow
box.addEventListener("dblclick", function (e) {
if (!e.target || e.target.tagName !== "IMG") return;
e.preventDefault();
openImageWindow(e.target);
});
box.addEventListener("click", function (e) {
if (e.target.tagName === "IMG") selectImg(e.target);
else selectImg(null);