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:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user