feat(project): 업무 창 작성자 표시·댓글 이미지 붙여넣기
- 업무 창 맨 위 삭제 버튼 오른쪽에 작성자 아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss) - 업무 창 댓글 칸 Ctrl+V 이미지 붙여넣기 — 썸네일 미리보기, 등록 시 /comments/files 한 요청 - 도움말 갱신, 브라우저 테스트 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -825,6 +825,15 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
position: relative; z-index: 2;
|
||||
}
|
||||
.pj-comment-dock[hidden] { display: none; }
|
||||
/* Ctrl+V 로 붙여넣은 이미지(보내기 전) — 입력칸 위 썸네일 줄, × 로 빼기(2026-10-21) */
|
||||
.pj-comment-pending { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 2px 8px; }
|
||||
.pj-comment-pending[hidden] { display: none; }
|
||||
.pj-comment-pending-img { position: relative; width: 64px; height: 64px; border: 1px solid #d8dce2; border-radius: 8px; overflow: hidden; background: #f6f7f9; }
|
||||
.pj-comment-pending-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||
.pj-comment-pending-img.is-failed { border-color: #e5484d; box-shadow: 0 0 0 1px #e5484d; }
|
||||
.pj-comment-pending-img button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none; border-radius: 50%;
|
||||
background: rgba(0,0,0,.55); color: #fff; font-size: 13px; line-height: 18px; padding: 0; cursor: pointer; }
|
||||
.pj-comment-pending-img button:hover { background: #c22b10; }
|
||||
.pj-comment-dock .pj-comment-form {
|
||||
border: 1px solid #d8dce2; border-radius: 12px; padding: 6px 6px 6px 4px; background: #fff;
|
||||
transition: border-color .12s, box-shadow .12s;
|
||||
@@ -970,6 +979,12 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
.pj-btn-complete { background: #e9f7ef; color: #1e8e5a; border: 1px solid #bfe8d2; font-weight: 500; }
|
||||
.pj-btn-complete:hover { background: #d9f2e4; }
|
||||
.pj-btn-complete.is-done { background: #f2f2f4; color: #6b6f76; border-color: var(--pj-border); }
|
||||
/* 업무 창 맨 위 작성자 — 삭제 버튼 오른쪽, 아이콘 + 이름(작성 시각) 한 줄(2026-10-21) */
|
||||
.pj-task-creator { flex: none; display: inline-flex; align-items: center; gap: 5px; margin-left: 4px;
|
||||
font-size: var(--pj-small-size); color: #6b6f76; white-space: nowrap; }
|
||||
.pj-task-creator[hidden] { display: none; }
|
||||
.pj-task-creator .pj-person-ic { width: 20px; height: 20px; font-size: 20px; border-radius: 50%; flex: none; }
|
||||
.pj-task-creator-name { color: #1e1f21; font-weight: 500; }
|
||||
|
||||
/* 색상표(아사나) — 8칸씩 둥근 네모, 고른 색엔 체크 */
|
||||
/* 12칸씩(2026-10-08) — 32색이 3줄 */
|
||||
|
||||
+94
-3
@@ -7639,6 +7639,7 @@
|
||||
syncDueBtn(); // 완료 여부(지남 표시)를 보려면 currentTaskData 다음에
|
||||
el("pj-delete-task").hidden = !task;
|
||||
el("pj-toggle-complete").hidden = !task;
|
||||
showTaskCreator(task);
|
||||
// 공유 링크는 저장된 업무에만 있다(새 업무는 아직 id 가 없다).
|
||||
const shareBtn = el("pj-share-task");
|
||||
if (shareBtn) shareBtn.hidden = !task;
|
||||
@@ -7649,6 +7650,7 @@
|
||||
el("pj-attach-block").hidden = !task;
|
||||
el("pj-comment-block").hidden = !task;
|
||||
el("pj-comment-dock").hidden = !task;
|
||||
clearCommentImages();
|
||||
// 세부 업무도 업무와 같은 팝업·같은 편집(아사나식). 다른 점은 세 가지 —
|
||||
// 제목 위에 상위 업무 경로, 세션 칸 없음(세부 업무는 세션이 없다),
|
||||
// 다른 프로젝트 연결(멀티호밍) 없음.
|
||||
@@ -7675,6 +7677,25 @@
|
||||
if (!task) setTimeout(function () { el("pj-t-title").focus(); }, 0);
|
||||
}
|
||||
|
||||
// 업무 창 맨 위 삭제 버튼 오른쪽 — 작성자 아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss).
|
||||
// created_at 은 서버가 KST ISO(2026-10-21T13:05:12+09:00)로 주므로 글자를 그대로 잘라 쓴다(브라우저 시간대 무관).
|
||||
function showTaskCreator(task) {
|
||||
const box = el("pj-task-creator");
|
||||
if (!box) return;
|
||||
const who = task && task.created_by;
|
||||
box.hidden = !who;
|
||||
if (!who) { box.innerHTML = ""; return; }
|
||||
const at = String(task.created_at || "");
|
||||
let when = "";
|
||||
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(at)) {
|
||||
const wd = ["일", "월", "화", "수", "목", "금", "토"][new Date(at.slice(0, 10) + "T00:00:00").getDay()];
|
||||
when = at.slice(0, 4) + "." + at.slice(5, 7) + "." + at.slice(8, 10) + "(" + wd + ") " + at.slice(11, 19);
|
||||
}
|
||||
box.innerHTML = personIconHtml(who) + '<span class="pj-task-creator-name">' + escapeHtml(idOf(who)) + "</span>" +
|
||||
(when ? '<span class="pj-task-creator-at">(' + escapeHtml(when) + ")</span>" : "");
|
||||
box.title = "작성자 " + who + (when ? " · " + when : "");
|
||||
}
|
||||
|
||||
// 작업 제목 — 한 줄 input 대신 textarea 라 창보다 길면 다음 줄로 넘어간다.
|
||||
// 제목은 한 줄 값이므로 Enter·붙여넣은 줄바꿈은 막고 공백으로 바꾼다.
|
||||
function fitTitleHeight() {
|
||||
@@ -8189,20 +8210,90 @@
|
||||
// 응답을 못 받고 다시 보내도 서버가 한 번만 만든다. 실패하면 입력은 그대로 남아 다시 보낼 수 있다.
|
||||
let commentSending = false;
|
||||
let commentToken = null;
|
||||
// Ctrl+V 로 붙여넣은 이미지 — 등록 때 본문과 한 요청(/comments/files, 댓글 대화창과 같은 API)으로 보낸다.
|
||||
// 업무를 바꾸면 비운다(다른 업무 댓글에 딸려 가지 않게). var — 페이지를 열자마자 업무 창이 열려
|
||||
// (?task=) 이 줄보다 먼저 clearCommentImages 가 불려도 TDZ 오류가 나지 않게.
|
||||
var commentImages = [];
|
||||
function renderCommentImages() {
|
||||
const box = el("pj-comment-pending");
|
||||
if (!box) return;
|
||||
box.querySelectorAll("img[data-url]").forEach(function (img) { URL.revokeObjectURL(img.dataset.url); });
|
||||
box.hidden = !commentImages.length;
|
||||
box.innerHTML = commentImages.map(function (it, i) {
|
||||
return '<span class="pj-comment-pending-img' + (it.err ? " is-failed" : "") + '" title="' +
|
||||
escapeHtml(it.err ? "보낼 수 없음: " + it.err : it.file.name) + '">' +
|
||||
'<img src="' + it.url + '" data-url="' + it.url + '" alt="' + escapeHtml(it.file.name) + '">' +
|
||||
'<button type="button" data-idx="' + i + '" title="빼기">×</button></span>';
|
||||
}).join("");
|
||||
box.querySelectorAll("button[data-idx]").forEach(function (btn) {
|
||||
btn.addEventListener("click", function () {
|
||||
commentImages.splice(parseInt(btn.dataset.idx, 10), 1);
|
||||
commentToken = null;
|
||||
renderCommentImages();
|
||||
});
|
||||
});
|
||||
}
|
||||
function clearCommentImages() {
|
||||
commentImages = [];
|
||||
renderCommentImages();
|
||||
}
|
||||
el("pj-comment-input").addEventListener("paste", function (e) {
|
||||
if (taskReadOnly) return;
|
||||
const cd = e.clipboardData || {};
|
||||
if (cd.getData && cd.getData("text/plain")) return; // 글자(주소 등)가 있으면 글자 붙여넣기가 먼저(대화창과 같음)
|
||||
const items = cd.items || [];
|
||||
let added = false;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
if (!items[i].type || items[i].type.indexOf("image/") !== 0) continue;
|
||||
const f = items[i].getAsFile();
|
||||
if (!f) continue;
|
||||
const ext = (f.type.split("/")[1] || "png").replace("jpeg", "jpg");
|
||||
const file = new File([f], "붙여넣은 이미지 " + (commentImages.length + 1) + "." + ext, { type: f.type });
|
||||
commentImages.push({ file: file, url: URL.createObjectURL(file), err: "" });
|
||||
added = true;
|
||||
}
|
||||
if (added) { e.preventDefault(); commentToken = null; renderCommentImages(); }
|
||||
});
|
||||
async function sendComment() {
|
||||
const inp = el("pj-comment-input");
|
||||
const body = inp.value.trim();
|
||||
const taskId = currentTaskId;
|
||||
if (!taskId || !body || commentSending || taskReadOnly) return;
|
||||
const imgs = commentImages.slice();
|
||||
if (!taskId || (!body && !imgs.length) || commentSending || taskReadOnly) return;
|
||||
const gen = taskGen;
|
||||
commentSending = true;
|
||||
commentToken = commentToken || newClientToken();
|
||||
el("pj-comment-send").disabled = true;
|
||||
try {
|
||||
const res = await api("POST", "/project/api/tasks/" + taskId + "/comments",
|
||||
{ body: body, mentions: takeMentions(inp), client_token: commentToken });
|
||||
let res;
|
||||
if (imgs.length) {
|
||||
const fd = new FormData();
|
||||
fd.append("body", body);
|
||||
fd.append("mentions", JSON.stringify(takeMentions(inp)));
|
||||
fd.append("client_token", commentToken);
|
||||
imgs.forEach(function (it) { fd.append("files", it.file, it.file.name); });
|
||||
const r = await fetch("/project/api/tasks/" + taskId + "/comments/files", { method: "POST", body: fd });
|
||||
let data = null;
|
||||
try { data = await r.json(); } catch (_) {}
|
||||
if (!r.ok) {
|
||||
const d = data && data.detail;
|
||||
const err = new Error(typeof d === "string" ? d : (d && d.message) || ("요청 실패 (" + r.status + ")"));
|
||||
err.status = r.status;
|
||||
(d && d.failed || []).forEach(function (f) {
|
||||
const it = imgs[parseInt(f.index, 10)];
|
||||
if (it) it.err = f.reason || "실패";
|
||||
});
|
||||
if (d && d.failed) renderCommentImages();
|
||||
throw err;
|
||||
}
|
||||
res = data;
|
||||
} else {
|
||||
res = await api("POST", "/project/api/tasks/" + taskId + "/comments",
|
||||
{ body: body, mentions: takeMentions(inp), client_token: commentToken });
|
||||
}
|
||||
commentToken = null;
|
||||
if (gen !== taskGen) return; // 그 사이 다른 작업 창 — 그 창의 입력칸을 비우지 않는다
|
||||
clearCommentImages();
|
||||
inp.value = "";
|
||||
fitComposer(inp);
|
||||
clearMentions(inp);
|
||||
|
||||
Reference in New Issue
Block a user