feat(project): 댓글 속 웹페이지 주소를 새 탭 링크로 + 주소 붙여넣기 보장

- 작업 팝업 댓글 목록·댓글 대화창 본문을 linkifyToHtml 로 그린다
  (https://… / www.… → target=_blank rel=noopener 링크, 나머지는 이스케이프)
- 대화창 입력칸 붙여넣기: 클립보드에 글자가 있으면 글자 우선(글자+그림을
  함께 복사하는 프로그램에서 주소가 그림으로 가로채이던 문제), 그림만 있을 때 첨부
- 정적 파일 버전 20260925j

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 20:06:49 +09:00
parent b324a9c413
commit 87c73c65af
7 changed files with 22 additions and 12 deletions
+3
View File
@@ -638,6 +638,9 @@
.pj-comment-head { font-size: 12.5px; font-weight: 700; color: #1e1f21; }
.pj-comment-time { font-weight: 400; color: #9aa1a9; font-size: 11px; margin-left: 6px; }
.pj-comment-body { font-size: 13px; color: #333; margin-top: 1px; white-space: pre-wrap; }
/* 댓글 속 웹페이지 주소 — 누르면 새 탭(linkifyToHtml). 긴 주소는 줄바꿈 */
.pj-comment-body a, .pj-chat-bubble a { color: #1a5fd0; text-decoration: underline; word-break: break-all; }
.pj-comment-body a:hover, .pj-chat-bubble a:hover { color: #0b3f99; }
.pj-comment-form { display: flex; align-items: center; gap: 6px; }
.pj-comment-form input { flex: 1; padding: 7px 10px; border: 1px solid #d8dce2; border-radius: 8px; font-size: 13px; font-family: inherit; box-sizing: border-box; }
.pj-comment-acts { display: inline-flex; gap: 1px; flex: 0 0 auto; }
+8 -3
View File
@@ -1214,7 +1214,11 @@
const cmInput = el("pj-cm-input");
attachMentionInput(cmInput);
if (cmInput) cmInput.addEventListener("paste", function (e) {
const items = (e.clipboardData || window.clipboardData || {}).items || [];
const cd = e.clipboardData || window.clipboardData || {};
// 글자(웹페이지 주소 등)가 있으면 글자 붙여넣기가 먼저 — 일부 프로그램은 복사할 때
// 글자와 함께 그림도 넣어서, 예전엔 그림으로 가로채 주소가 안 붙었다.
if (cd.getData && cd.getData("text/plain")) return;
const items = cd.items || [];
let handled = false;
for (let i = 0; i < items.length; i++) {
if (items[i].type && items[i].type.indexOf("image/") === 0) {
@@ -1291,7 +1295,7 @@
inner +
"</div>";
const bubble = li.querySelector(".pj-chat-bubble");
if (bubble) bubble.textContent = c.body;
if (bubble) bubble.innerHTML = linkifyToHtml(c.body); // 주소 → 새 탭 링크(나머지는 이스케이프)
if (mine) {
li.querySelector(".pj-chat-del").addEventListener("click", async function () {
if (!confirm("이 댓글을 삭제할까요? 첨부된 파일도 함께 삭제됩니다.")) return;
@@ -4465,7 +4469,8 @@
'<button type="button" class="pj-icon-btn pj-comment-edit" title="수정">✎</button>' +
'<button type="button" class="pj-icon-btn pj-comment-del" title="삭제">×</button>' +
"</span>";
li.querySelector(".pj-comment-body").textContent = c.body; // XSS 안전(textContent)
// 주소 → 새 탭 링크. linkifyToHtml 이 나머지 글자를 전부 이스케이프하므로 XSS 안전.
li.querySelector(".pj-comment-body").innerHTML = linkifyToHtml(c.body);
li.querySelector(".pj-comment-del").addEventListener("click", async function () {
try { await api("DELETE", "/project/api/comments/" + c.id); loadComments(taskId); }
catch (e) { alert("삭제 실패: " + e.message); }