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:
@@ -58,6 +58,9 @@
|
||||
## 업무 창 / 댓글 / 협업자
|
||||
|
||||
- 작업 창은 **저장 버튼 없이 실시간 저장**(칸별 PUT, `saveField`/`saveChain`, 새 작업은 제목이 생기는 순간 생성).
|
||||
- 업무 창 맨 위 **삭제 오른쪽 = 작성자**(2026-10-21, `showTaskCreator` — `created_by` 아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss), `created_at` KST ISO 글자를 그대로 잘라 씀, 세부 업무도).
|
||||
- 업무 창 댓글 칸 **Ctrl+V 이미지 붙여넣기**(2026-10-21) — 칸 위 썸네일(×로 빼기) → [등록] = `POST …/comments/files` 한 요청(댓글 대화창과 같은 API, 글 없이 이미지만도), 업무를 바꾸면 비움.
|
||||
복사한 내용에 글자가 있으면 글자 붙여넣기가 먼저(대화창과 같음). 브라우저 테스트 `tests/js/task_creator_paste.browser.test.js`.
|
||||
- **파일 끌어 놓기**(2026-10-19): 종류 "Files" 로 카드·세부 업무 끌기와 구분, 받는 곳 밖에 놓친 파일은 document 가 막아 화면이 파일로 넘어가지 않음.
|
||||
- **설명란·세부 업무 목록·보드 카드(펼친 세부 업무 줄) → 구글 드라이브**: `POST /project/api/tasks/{id}/drive-files`(`app/integrations/google_drive.py`, 최상위 `PROJECT_DRIVE_FOLDER_ID` 기본 `1Zdak2FtACRJ6peOnA9zD22hsbbsTixJG` 아래 `프로젝트/섹션/업무/세부 업무` 폴더 자동, 세부 업무 섹션 = 맨 위 업무 섹션). 링크 제목 = 파일 이름.확장자(새 탭). 설명란 = 놓은 자리(`descEditor.insertDriveFiles`, 올리는 중 표시·저장 미룸), 세부 업무 줄·카드 = `append=true` 로 서버가 설명 끝에 붙임 — 단 지금 업무 창에 열린 업무면 편집기 끝에(옛 설명 저장이 링크를 덮지 않게, `dropDriveFilesOnTask`).
|
||||
- **링크를 지우면 드라이브 휴지통**: `api_update_task` 가 설명 저장 전후 드라이브 링크 id 를 비교 → 백그라운드 `_sync_drive_links` — 우리가 올린 파일(appProperties `dbxTaskId`)만, 다른 업무 설명에 같은 링크가 있으면 그대로(`db.description_mentions`), 링크가 다시 생기면 휴지통에서 꺼냄. DB 변경 없음.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "project/_meeting_content_base.html" if meeting_embedded else "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -289,5 +289,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261012a" defer></script>
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/project-help.css?v=20261003a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
@@ -326,6 +326,7 @@
|
||||
<tr><td><span class="pjh-ui"><span class="material-symbols-outlined">link</span>공유</span></td><td>이 업무의 주소를 복사합니다. 메신저로 보내면 받은 멤버가 바로 이 업무를 엽니다.</td></tr>
|
||||
<tr><td><span class="pjh-ui">✓ 완료로 표시</span></td><td>업무를 완료합니다. 다시 누르면 <span class="pjh-ui">↩ 완료 취소</span>.</td></tr>
|
||||
<tr><td><span class="pjh-ui">삭제</span></td><td>업무를 지웁니다(만든 사람만). 세부 업무가 있으면 함께 지울지 한 번 더 묻습니다. 지운 업무는 휴지통에 3개월 보관됩니다.</td></tr>
|
||||
<tr><td>작성자</td><td><span class="pjh-ui">삭제</span> 오른쪽에 업무를 만든 사람(아이콘 + 이름)과 만든 시각 <b>yyyy.mm.dd(요일) hh:mm:ss</b>가 보입니다. 세부 업무도 같습니다.</td></tr>
|
||||
<tr><td><span class="pjh-ui">저장됨</span></td><td>저장 버튼이 없습니다 — 고치는 즉시 저장되고, 버튼 줄 오른쪽에 <span class="pjh-ui">저장 중…</span> → <span class="pjh-ui">✓ 저장됨</span>이 잠깐 보입니다. 저장이 안 되면 <span class="pjh-ui">저장 실패 · 다시 시도</span>(눌러서 다시 저장)가 뜨고, 이 상태로 창을 닫거나 다른 업무를 열면 한 번 더 저장해 본 뒤 <b>버리고 넘어갈지 / 계속 편집할지</b> 묻습니다 — 모른 채 내용이 사라지지 않습니다. 이미지를 올리는 중이면 다 올라갈 때까지 기다렸다가 넘어갑니다.</td></tr>
|
||||
</table>
|
||||
<div class="pjh-note"><span class="material-symbols-outlined">info</span>
|
||||
@@ -373,6 +374,7 @@
|
||||
<p>업무는 하나라서 원래 프로젝트에서 고친 내용이 연결된 보드에도 반영됩니다. 원래 프로젝트의 멤버가 아니면 연결된 업무의 내용·댓글·첨부는 읽기만 할 수 있습니다. 연결된 보드 안에서 섹션을 옮기는 것은 가능합니다.</p>
|
||||
<h3>댓글</h3>
|
||||
<p>업무 창 맨 아래에 항상 고정된 댓글 칸에 쓰고 <kbd>Enter</kbd>(스크롤해도 그 자리에 있습니다). 칸 오른쪽 <span class="pjh-ui">☺</span>는 이모티콘, <span class="pjh-ui">@</span>는 멤버 태그입니다. 답글은 원 댓글 아래 들여 쓰여 <span class="pjh-ui">↳</span> 표시와 함께 보입니다. 내가 쓴 댓글은 <span class="pjh-ui">✎</span>로 고치고 <span class="pjh-ui">×</span>로 지웁니다. 댓글 속 웹 주소는 링크가 됩니다. 댓글에 붙인 파일은 그 댓글 아래에 보이고(파일만 보낸 댓글도), 첨부 파일 목록에는 <span class="pjh-ui">댓글</span> 표시가 붙습니다.</p>
|
||||
<p>캡처한 이미지를 댓글 칸에 <kbd>Ctrl</kbd>+<kbd>V</kbd>로 붙여넣으면 칸 위에 작은 미리보기로 담기고(<span class="pjh-ui">×</span>로 빼기), <span class="pjh-ui">등록</span>하면 글과 함께 댓글 첨부로 올라갑니다. 글 없이 이미지만 보내도 됩니다. 복사한 내용에 글자가 함께 있으면 글자가 붙습니다.</p>
|
||||
<p>댓글 대화창에서 파일을 보낼 때 보낼 수 없는 파일(빈 파일, 20MB 초과)이 있으면 댓글을 만들지 않고 그 파일만 빨갛게 표시합니다 — 빼고 다시 보내세요. 인터넷이 끊겨도 쓴 내용과 파일은 그대로 남아 다시 보낼 수 있고, 같은 댓글이 두 번 올라가지 않습니다. @태그는 이 업무를 볼 수 있는 사람만 고를 수 있습니다. 한글을 입력하는 중(조합 중)의 <kbd>Enter</kbd>는 글자 확정만 하고 보내지 않습니다.</p>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -106,5 +106,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -108,5 +108,5 @@
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -244,6 +244,8 @@
|
||||
</button>
|
||||
<button type="button" class="pj-btn pj-btn-complete" id="pj-toggle-complete" hidden>✓ 완료로 표시</button>
|
||||
<button type="button" class="pj-btn pj-btn-danger" id="pj-delete-task" hidden>삭제</button>
|
||||
<!-- 작성자 — 아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss), 만든 사람(created_by)이 있는 업무만(2026-10-21). -->
|
||||
<span class="pj-task-creator" id="pj-task-creator" hidden></span>
|
||||
<!-- 수신함 오른쪽 패널(?embed=1)에서만 보인다 — 이 작업이 있는 프로젝트 화면으로 이동. -->
|
||||
<button type="button" class="pj-btn pj-btn-goto-project" id="pj-goto-project" title="이 업무가 있는 프로젝트 화면으로 이동">
|
||||
<span class="material-symbols-outlined">open_in_new</span> 프로젝트로 이동
|
||||
@@ -400,6 +402,8 @@
|
||||
<!-- 댓글 입력칸 — 아사나처럼 작업 창 맨 아래에 항상 고정. 스크롤 영역(.pj-modal-body)
|
||||
바깥이라 끝까지 내려도 마지막 내용은 이 칸 바로 위에서 멈추고 가리지 않는다. -->
|
||||
<div class="pj-comment-dock" id="pj-comment-dock" hidden>
|
||||
<!-- Ctrl+V 로 붙여넣은 이미지(보내기 전) — 썸네일 + ×, 등록하면 댓글 첨부로 같이 간다(2026-10-21). -->
|
||||
<div class="pj-comment-pending" id="pj-comment-pending" hidden></div>
|
||||
<div class="pj-comment-form">
|
||||
<textarea id="pj-comment-input" class="pj-composer-ta" rows="1" placeholder="댓글을 추가하거나 @로 멤버를 태그하세요 (Shift+Enter 줄바꿈)" autocomplete="off"></textarea>
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-comment-send">등록</button>
|
||||
@@ -472,5 +476,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261019j" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261021a" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261019g" defer></script>
|
||||
<script src="/static/project.js?v=20261021a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -32,7 +32,7 @@ def task(tid: int, title: str, pid: int, stage: int, *, ctx: int | None = None,
|
||||
"stage_id": stage, "home_stage_id": stage, "stage_name": "할 일", "is_done_stage": False,
|
||||
"description": "", "assignee_email": "", "assignee_name": "", "priority": "normal",
|
||||
"start_date": None, "due_date": None, "completed_at": None, "created_by": ME,
|
||||
"parent_task_id": None, "comment_count": 0, "subtask_count": 0, "subtask_done": 0,
|
||||
"created_at": "2026-10-21T13:05:09+09:00", "parent_task_id": None, "comment_count": 0, "subtask_count": 0, "subtask_done": 0,
|
||||
"project_name": {1: "P1", 2: "P2", 3: "비밀"}[pid], "project_color": "#4573d2", "sort_order": tid}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// 실제 브라우저 — 업무 창 맨 위 작성자(아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss), 삭제 버튼 오른쪽)와
|
||||
// 댓글 칸 Ctrl+V 이미지 붙여넣기(썸네일 → 등록 = /comments/files 한 요청, 업무를 바꾸면 비움)를 확인한다(2026-10-21).
|
||||
// python tests/js/render_project.py
|
||||
// NODE_PATH=<playwright 경로> PJ_TEST_BROWSER=<Chrome 경로> node tests/js/task_creator_paste.browser.test.js
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs"), path = require("node:path"), http = require("node:http");
|
||||
const { chromium } = require("playwright");
|
||||
const ROOT = path.resolve(__dirname, "../.."), OUT = path.join(__dirname, ".out"), STATIC = path.join(ROOT, "app/static");
|
||||
|
||||
const detail = (id) => ({ id, title: "작업 " + id, project_id: 1, stage_id: 11, description: "", priority: "normal",
|
||||
assignee_email: "", subtasks: [], links: [], followers: [], access: "full", completed_at: null,
|
||||
created_by: "me@test.local", created_at: "2026-10-21T13:05:09+09:00" });
|
||||
const posts = [];
|
||||
const server = http.createServer(async (req, res) => {
|
||||
const url = new URL(req.url, "http://localhost");
|
||||
const json = (code, body) => { res.statusCode = code; res.setHeader("Content-Type", "application/json"); res.end(JSON.stringify(body)); };
|
||||
if (url.pathname === "/project/p/1") { res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end(fs.readFileSync(path.join(OUT, "project_render.html"))); return; }
|
||||
if (url.pathname.startsWith("/project/api/")) {
|
||||
const chunks = []; for await (const c of req) chunks.push(c);
|
||||
const raw = Buffer.concat(chunks);
|
||||
const task = /^\/project\/api\/tasks\/(\d+)$/.exec(url.pathname);
|
||||
if (task && req.method === "GET") return json(200, { task: detail(+task[1]) });
|
||||
if (/\/comments(\/files)?$/.test(url.pathname) && req.method === "POST") {
|
||||
posts.push({ path: url.pathname, type: req.headers["content-type"] || "", body: raw.toString("utf8") });
|
||||
return json(201, { comment: { id: 1 }, attachments: [], mention_skipped: [] });
|
||||
}
|
||||
if (url.pathname.endsWith("/comments")) return json(200, { comments: [], events: [], features: {} });
|
||||
if (url.pathname.endsWith("/attachments")) return json(200, { attachments: [] });
|
||||
if (url.pathname.endsWith("/members")) return json(200, { members: [{ user_email: "me@test.local" }] });
|
||||
if (url.pathname.endsWith("/live-version")) return json(200, { ts: "v1" });
|
||||
if (url.pathname.endsWith("/alerts")) return json(200, { me: "me@test.local", latest_id: 0, alerts: [] });
|
||||
return json(200, {});
|
||||
}
|
||||
if (url.pathname.startsWith("/static/")) {
|
||||
const file = path.join(STATIC, decodeURIComponent(url.pathname.slice("/static/".length)));
|
||||
if (file.startsWith(STATIC) && fs.existsSync(file)) {
|
||||
res.setHeader("Content-Type", file.endsWith(".js") ? "text/javascript" : file.endsWith(".css") ? "text/css" : "application/octet-stream");
|
||||
res.end(fs.readFileSync(file)); return;
|
||||
}
|
||||
}
|
||||
res.statusCode = 404; res.end("");
|
||||
});
|
||||
|
||||
// 붙여넣기 — 이미지만 든 클립보드(캡처 도구)를 흉내 낸다. 반환 = 기본 동작(글자 붙여넣기)을 막았는지.
|
||||
const pasteImage = (page) => page.evaluate(async () => {
|
||||
const c = document.createElement("canvas"); c.width = 8; c.height = 8;
|
||||
c.getContext("2d").fillRect(0, 0, 8, 8);
|
||||
const blob = await new Promise(r => c.toBlob(r, "image/png"));
|
||||
const dt = new DataTransfer();
|
||||
dt.items.add(new File([blob], "image.png", { type: "image/png" }));
|
||||
const ev = new ClipboardEvent("paste", { clipboardData: dt, bubbles: true, cancelable: true });
|
||||
document.getElementById("pj-comment-input").dispatchEvent(ev);
|
||||
return ev.defaultPrevented;
|
||||
});
|
||||
|
||||
(async function () {
|
||||
await new Promise(r => server.listen(0, "127.0.0.1", r));
|
||||
const base = "http://127.0.0.1:" + server.address().port;
|
||||
const browser = await chromium.launch(process.env.PJ_TEST_BROWSER ? { executablePath: process.env.PJ_TEST_BROWSER } : {});
|
||||
const page = await browser.newPage({ viewport: { width: 1920, height: 1080 } });
|
||||
const errors = [];
|
||||
page.on("pageerror", e => errors.push(e.message));
|
||||
const pass = [];
|
||||
const ok = (name, cond, extra) => { assert.ok(cond, name + (extra === undefined ? "" : " → " + JSON.stringify(extra))); pass.push(name); console.log("PASS " + name); };
|
||||
try {
|
||||
await page.goto(base + "/project/p/1?task=101");
|
||||
await page.waitForFunction(() => { const m = document.getElementById("pj-modal-task"); return m && !m.hidden && document.getElementById("pj-t-id").value; });
|
||||
const creator = await page.evaluate(() => {
|
||||
const b = document.getElementById("pj-task-creator"), del = document.getElementById("pj-delete-task");
|
||||
const br = b.getBoundingClientRect(), dr = del.getBoundingClientRect();
|
||||
const text = b.querySelector(".pj-task-creator-name").textContent + b.querySelector(".pj-task-creator-at").textContent;
|
||||
return { hidden: b.hidden, text: text, icon: !!b.querySelector(".pj-person-ic"),
|
||||
rightOfDelete: br.left >= dr.right, sameRow: Math.abs((br.top + br.bottom) / 2 - (dr.top + dr.bottom) / 2) < 4 };
|
||||
});
|
||||
ok("작성자 = 아이콘 + 이름(yyyy.mm.dd(요일) hh:mm:ss)", !creator.hidden && creator.icon && creator.text === "Me(2026.10.21(수) 13:05:09)", creator);
|
||||
ok("작성자는 삭제 버튼 오른쪽 같은 줄", creator.rightOfDelete && creator.sameRow, creator);
|
||||
await page.locator("#pj-modal-task .pj-modal-actions-top").screenshot({ path: path.join(OUT, "task_creator.png") });
|
||||
|
||||
ok("이미지 붙여넣기는 기본 붙여넣기를 막고 담는다", await pasteImage(page));
|
||||
await pasteImage(page);
|
||||
ok("입력칸 위 썸네일 두 개", await page.evaluate(() => {
|
||||
const box = document.getElementById("pj-comment-pending");
|
||||
return !box.hidden && box.querySelectorAll(".pj-comment-pending-img img").length === 2; }));
|
||||
await page.click("#pj-comment-pending button[data-idx='1']");
|
||||
ok("× 로 하나 빼기", await page.evaluate(() => document.querySelectorAll("#pj-comment-pending img").length === 1));
|
||||
await page.click("#pj-comment-send"); // 글 없이 이미지만
|
||||
await page.waitForFunction(() => document.getElementById("pj-comment-pending").hidden);
|
||||
const p = posts[posts.length - 1];
|
||||
ok("등록 = /comments/files 한 요청(파일 1개, '붙여넣은 이미지 1.png')", p && p.path === "/project/api/tasks/101/comments/files" &&
|
||||
/multipart\/form-data/.test(p.type) && (p.body.match(/name="files"/g) || []).length === 1 &&
|
||||
p.body.includes("붙여넣은 이미지 1.png"), p && { path: p.path, type: p.type });
|
||||
|
||||
await page.fill("#pj-comment-input", "글만");
|
||||
await page.click("#pj-comment-send");
|
||||
await page.waitForFunction(() => document.getElementById("pj-comment-input").value === "");
|
||||
ok("이미지 없으면 예전처럼 JSON 댓글", posts[posts.length - 1].path === "/project/api/tasks/101/comments");
|
||||
|
||||
await pasteImage(page);
|
||||
await page.goto(base + "/project/p/1?task=102");
|
||||
await page.waitForFunction(() => document.getElementById("pj-t-id").value === "102");
|
||||
ok("새로 연 업무 창엔 붙여넣은 이미지 없음", await page.evaluate(() => document.getElementById("pj-comment-pending").hidden));
|
||||
ok("페이지 오류 없음", errors.length === 0, errors);
|
||||
console.log("\nALL PASS (" + pass.length + ")");
|
||||
} finally {
|
||||
await browser.close();
|
||||
server.close();
|
||||
}
|
||||
})().catch(e => { console.error(e); process.exit(1); });
|
||||
Reference in New Issue
Block a user