Merge branch 'fix/perf-no-cell-tips-project-image-fit'

This commit is contained in:
2026-10-22 12:49:41 +09:00
16 changed files with 84 additions and 41 deletions
+2
View File
@@ -73,6 +73,8 @@
- 메모 있는 칸 = 오른쪽 위 빨간 삼각형(`has-memo`, 엑셀 메모처럼), 마우스 올리면 노란 메모 상자(`.perf-memo-tip`). 금액과 따로 저장(금액 지워도 남음).
화면 데이터 `memo_cells`("날짜|코드" → 메모, `db.cell_memos`), 010 미적용이면 표시 없음·저장만 503. 표를 스크롤하면 열린 메뉴는 닫힌다.
- 테스트 `test_cell_memos.py`, `tests/js/perf_memo_ads.browser.test.js`.
- **표 몸통 칸에는 풍선 도움말(title) 없음**(2026-10-22 사용자 요청) — 입력 칸·날짜 칸(공휴일은 칸 안 글자)·광고비 줄 모두. 열 머리글 말풍선은 그대로.
새 칸 기능에 title 을 다시 달지 말 것(설명은 표 아래 안내 문구에).
## 광고비 (`/performance/ads`)
@@ -109,7 +109,7 @@
<tbody>
{% for r in table %}
<tr class="perf-row-{{ r.kind }}{% if r.weekday == 5 %} is-sat{% endif %}{% if r.weekday == 6 or r.holiday %} is-sun{% endif %}{% if r.today %} is-today{% endif %}{% if r.future %} is-future{% endif %}">
<th class="perf-td-label" scope="row"{% if r.holiday %} title="{{ r.holiday }}"{% endif %}>
<th class="perf-td-label" scope="row">
{{ r.label }}{% if r.holiday %}<small class="perf-hol">{{ r.holiday }}</small>{% endif %}
</th>
{% for c in codes %}
@@ -120,8 +120,7 @@
{% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) if not up and not ap else none %}
{% set memo = (memo_cells or {}).get(r.date ~ '|' ~ c) %}{#- 메모(010) -#}
<td class="perf-num is-manual-cell{% if v and not up and not ap %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if up %} is-upload{% endif %}{% if ap %} is-api{% endif %}{% if memo %} has-memo{% endif %}"
data-manual-code="{{ c }}" data-date="{{ r.date }}" data-manual-value="{{ v if v else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0"
title="{% if ap %}광고 API 값 — 눌러 고치기(다음 불러오기 때 다시 API 값으로){% elif up %}파일 업로드 값 — 눌러 고치기{% elif fx %}계산식 {{ fx }} — 눌러 고치기{% else %}눌러 광고비 입력(1000+2000 같은 계산식도 됨, 비우고 저장하면 지움){% endif %}"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
data-manual-code="{{ c }}" data-date="{{ r.date }}" data-manual-value="{{ v if v else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% else %}
<td class="perf-num"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% endif %}
@@ -241,4 +240,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022c" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
@@ -13,14 +13,14 @@
{%- endmacro -%}
{#- 매출 칸 아래 광고비(ROAS%) — 광고비 화면과 같은 값·색. 카페24 = 구글·메타 두 줄(이름 붙임) -#}
{%- macro adl(lines) -%}
{%- for a in lines or [] -%}<span class="perf-adl" title="{{ (a.label ~ ' ') if a.label }}광고비 {{ '{:,}'.format(a.amount) }}원{% if a.roas is not none %} · ROAS {{ '{:,}'.format(a.roas) }}%{% endif %}">{% if a.label %}<i>{{ a.label }}</i>{% endif %}{{ amt(a.amount) }}{% if a.roas is not none %}<em>({{ "{:,}".format(a.roas) }}%)</em>{% endif %}</span>{%- endfor -%}
{%- for a in lines or [] -%}<span class="perf-adl">{% if a.label %}<i>{{ a.label }}</i>{% endif %}{{ amt(a.amount) }}{% if a.roas is not none %}<em>({{ "{:,}".format(a.roas) }}%)</em>{% endif %}</span>{%- endfor -%}
{%- endmacro -%}
{#- 일 합계 광고비(ROAS%) — ROAS = 일 합계 금액 ÷ 일 합계 광고비. 수수료 차감 매출 보기면 차감 매출 기준, 그 밖엔 총매출 기준 -#}
{%- macro adl_total(a) -%}
{%- for key, cls in (("roas", "for-gross"), ("roas_net", "for-net")) -%}
{%- set rs = a[key] -%}
<span class="perf-adl perf-adl-tot {{ cls }}" title="광고비 합계 {{ '{:,}'.format(a.amount) }}원{% if rs is not none %} · ROAS {{ '{:,}'.format(rs) }}% (일 합계 {{ '수수료 차감 매출' if key == 'roas_net' else '총매출' }} ÷ 광고비){% endif %}">{{ amt(a.amount) }}{% if rs is not none %}<em>({{ "{:,}".format(rs) }}%)</em>{% endif %}</span>
<span class="perf-adl perf-adl-tot {{ cls }}">{{ amt(a.amount) }}{% if rs is not none %}<em>({{ "{:,}".format(rs) }}%)</em>{% endif %}</span>
{%- endfor -%}
{%- endmacro -%}
@@ -153,7 +153,7 @@
<tbody>
{% for r in table %}
<tr class="perf-row-{{ r.kind }}{% if r.weekday == 5 %} is-sat{% endif %}{% if r.weekday == 6 or r.holiday %} is-sun{% endif %}{% if r.today %} is-today{% endif %}{% if r.future %} is-future{% endif %}">
<th class="perf-td-label" scope="row"{% if r.holiday %} title="{{ r.holiday }}"{% endif %}>
<th class="perf-td-label" scope="row">
{{ r.label }}{% if r.holiday %}<small class="perf-hol">{{ r.holiday }}</small>{% endif %}
</th>
{% for col in cols %}
@@ -169,8 +169,7 @@
{% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) %}
{% set memo = (memo_cells or {}).get(r.date ~ '|' ~ c) %}{#- 메모(010) — 우클릭 메모 삽입·수정·삭제, 있으면 칸 오른쪽 위 빨간 삼각형 -#}
<td class="perf-num is-manual-cell{% if is_manual %} is-manual{% endif %}{% if fx %} is-formula{% endif %}{% if glast %} is-glast{% endif %}{% if memo %} has-memo{% endif %}"{{ gattr }} data-manual-code="{{ c }}" data-date="{{ r.date }}"
data-manual-value="{{ m.gross if is_manual else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0"
title="{% if fx %}계산식 {{ fx }} — 눌러 고치기{% elif is_manual %}수동 입력값 — 눌러 고치기(비우고 저장하면 API 값){% else %}눌러 총매출 직접 입력(1000+2000 같은 계산식도 됨){% endif %}">{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
data-manual-value="{{ m.gross if is_manual else '' }}"{% if fx %} data-formula="{{ fx }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %} tabindex="0">{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
{% else %}
<td class="perf-num{% if r['from'] and (m.gross or m.commission) %} is-link{% endif %}{% if glast %} is-glast{% endif %}"{{ gattr }}
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
@@ -290,4 +289,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022c" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
@@ -259,4 +259,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022c" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261022d" defer></script>{% endblock %}
+2 -1
View File
@@ -62,7 +62,8 @@
- 업무 창 댓글 칸 **Ctrl+V 이미지 붙여넣기**(2026-10-21) — 칸 위 썸네일(×로 빼기) → [등록] = `POST …/comments/files` 한 요청(댓글 대화창과 같은 API, 글 없이 이미지만도), 업무를 바꾸면 비움.
복사한 내용에 글자가 있으면 글자 붙여넣기가 먼저(대화창과 같음). 브라우저 테스트 `tests/js/task_creator_paste.browser.test.js`.
- **댓글 사진 누르기 = 이미지 창**(2026-10-22) — 업무 창 댓글·댓글 대화창의 사진(`a.pj-comment-att-img`·`.pj-chat-att-img a`)을 누르면 내려받지 않고
`openImageWindow(img, {actual, download, name})` 별도 창: 처음 100%(창보다 커도, 끌어 이동), 휠 확대·축소, [원본 보기](=100%, 예전 "1:1")·[맞춤]·[복사]·[다운로드](첨부 download 주소).
`openImageWindow(img, {fill, download, name})` 별도 창: **처음 = 맞춤으로 창에 꽉 참**(창 = 사진 비율, 가장자리 검은 공간 없음, 막대는 사진 위에 뜸, 창 크기를 바꿔도
맞춤 상태면 다시 맞춤 — 확대·끌기 뒤엔 그대로), 끌어 이동, 휠 확대·축소, [원본 보기](=100%, 예전 "1:1")·[맞춤]·[복사]·[다운로드](첨부 download 주소).
Ctrl·Shift·가운데 클릭은 예전처럼 링크. 설명란 이미지 더블클릭은 그대로(처음 맞춤). 테스트 `tests/js/comment_image_viewer.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`).
@@ -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=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% 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=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
@@ -106,5 +106,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
@@ -108,5 +108,5 @@
});
})();
</script>
<script src="/static/project.js?v=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
@@ -476,5 +476,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
@@ -70,5 +70,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261022b" defer></script>
<script src="/static/project.js?v=20261022c" defer></script>
{% endblock %}
+1 -3
View File
@@ -712,9 +712,7 @@
td.classList.remove("is-upload", "is-api");
const ro = td.querySelector(".perf-roas"); // 광고비가 바뀌면 ROAS 는 새로고침 때 다시 계산
if (ro) ro.remove();
td.title = res.formula ? "계산식 " + res.formula + " — 눌러 고치기"
: manual !== "" ? "직접 입력값 — 눌러 고치기(비우고 저장하면 " + (FIXED_METRIC ? "지움" : "API 값") + ")"
: "눌러 " + MANUAL_WORD + " 직접 입력";
// 칸 풍선 도움말은 두지 않는다(2026-10-22 사용자 요청) — 설명은 표 아래 안내 문구에
// 총매출·수수료·차감 매출을 바로 바꾼다(기본 보기 = 차감 매출 — 예전엔 총매출만 바뀌어 계산식 결과가 안 보였다).
// 서버가 수수료를 안 돌려주면(광고비) 그 칸만 새로고침 때까지 흐리게.
const shown = { "v-gross": res.amount, "v-commission": res.commission, "v-net": res.net };
+32 -15
View File
@@ -2350,15 +2350,27 @@
// 창 크기 = 이미지 원본 크기(+ 여백·도구 막대), 화면보다 크면 화면 95% 까지. 처음엔 원본(100%), 창보다 크면 창에 맞춤.
// 창 안: 휠 = 마우스 위치 기준 확대·축소, 끌기 = 이동, 아래 막대 − / % / + · 1:1(원본) · 맞춤,
// 더블클릭 = 원본 ↔ 맞춤, 키보드 + − 0(맞춤) 1(원본). 이미지는 같은 서버 첨부 주소라 로그인 쿠키로 그대로 열린다.
// opts(2026-10-22 댓글 사진) — actual: 창보다 커도 처음부터 100%(원본)로(끌어서 이동), download: 다운로드 주소(막대에 [다운로드]),
// name: 창 제목·파일 이름. 막대의 [원본 보기] = 100% 로 되돌리기(예전 "1:1").
// opts(2026-10-22 댓글 사진) — fill: 창 = 사진 비율 그대로·맞춤으로 꽉 차게(가장자리 검은 공간 없음, 막대는 사진 위에 뜸,
// 창 크기를 바꿔도 맞춤 상태면 다시 맞춤), download: 다운로드 주소(막대에 [다운로드]), name: 창 제목·파일 이름.
// 막대의 [원본 보기] = 100% 로(예전 "1:1").
function openImageWindow(img, opts) {
opts = opts || {};
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, 560), sw * 0.95)); // 최소 560 — 아래 막대(다운로드 포함)가 한 줄로 다 들어가게
const h = Math.round(Math.min(Math.max(nh + 110, 360), sh * 0.95));
let w, h;
if (opts.fill) {
// 창 안쪽 = 사진 비율 그대로(화면 92%, 높이는 브라우저 머리 약 90px 뺀 만큼 안에서 원본 이하).
// 폭은 최소 560 — 아래 막대(다운로드 포함)가 한 줄로 들어가게, 작은 사진은 그만큼 키워 꽉 채운다.
const maxW = sw * 0.92, maxH = sh * 0.92 - 90;
let sc = Math.min(1, maxW / nw, maxH / nh);
if (nw * sc < 560) sc = Math.min(560 / nw, maxH / nh);
w = Math.max(560, Math.round(nw * sc));
h = Math.round(nh * sc);
} else {
w = Math.round(Math.min(Math.max(nw + 48, 560), sw * 0.95)); // 최소 560 — 아래 막대(다운로드 포함)가 한 줄로 다 들어가게
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(),
@@ -2405,23 +2417,28 @@
"<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;" +
"var s=1,x=0,y=0,MIN=0.05,MAX=16,BAR=60,FILL=" + (opts.fill ? "true" : "false") + ",fitted=false;" +
"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(" + (opts.actual ? "1" : "f<1?f:1") + ");};" +
"function zoomAt(n,cx,cy){fitted=false;n=Math.min(MAX,Math.max(MIN,n));x=cx-(cx-x)*n/s;y=cy-(cy-y)*n/s;s=n;apply();}" +
// FILL(댓글 사진) = 여백·막대 자리 없이 창 전체에 맞춤(막대는 사진 위에 뜬다)
"function centerAt(n){s=n;fitted=false;x=(innerWidth-img.naturalWidth*s)/2;" +
"y=FILL?(innerHeight-img.naturalHeight*s)/2:(innerHeight-BAR-img.naturalHeight*s)/2+4;if(!FILL&&y<8)y=8;apply();}" +
"function fitScale(){return FILL?Math.min(innerWidth/img.naturalWidth,innerHeight/img.naturalHeight)" +
":Math.min((innerWidth-32)/img.naturalWidth,(innerHeight-BAR-24)/img.naturalHeight);}" +
"function fit(){centerAt(fitScale());fitted=true;}" +
"img.onload=function(){var f=fitScale();if(FILL){fit();}else{centerAt(f<1?f:1);}};" +
"addEventListener('resize',function(){if(fitted)fit();});" +
"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();});" +
"stage.addEventListener('pointermove',function(e){if(!drag)return;fitted=false;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);}});" +
"stage.addEventListener('dblclick',function(e){if(Math.abs(s-1)<0.01){fit();}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());};" +
"document.getElementById('fit').onclick=function(){fit();};" +
// 복사 = PNG 그림만(copyImageToClipboard 와 같은 이유 — 브라우저 기본 "이미지 복사"의 첨부 주소 HTML 은 로그인 없인 안 열림)
"var msg=document.getElementById('msg'),mt=0;" +
"function note(t,bad){msg.textContent=t;msg.className=bad?'show bad':'show';clearTimeout(mt);mt=setTimeout(function(){msg.className=bad?'bad':'';},1800);}" +
@@ -2434,7 +2451,7 @@
"document.getElementById('copy').onclick=copyImg;" +
"addEventListener('keydown',function(e){if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey&&(e.code==='KeyC'||e.key==='c'||e.key==='C')){e.preventDefault();copyImg();return;}" +
"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();}});" +
"else if(e.key==='0'){fit();}else if(e.key==='1'){centerAt(1);}else if(e.key==='Escape'){window.close();}});" +
"})();<\/script></body></html>";
win.document.open();
win.document.write(html);
@@ -2445,7 +2462,7 @@
try { win.focus(); } catch (_) {}
}
// ── 댓글에 첨부된 사진(업무 창 댓글 목록·댓글 대화창) — 누르면 내려받지 않고 이미지 창(100%, 끌어 이동·휠 확대·다운로드·원본 보기)
// ── 댓글에 첨부된 사진(업무 창 댓글 목록·댓글 대화창) — 누르면 내려받지 않고 이미지 창(맞춤으로 꽉 차게, 끌어 이동·휠 확대·다운로드·원본 보기)
// 으로 연다(2026-10-22). Ctrl·Shift·가운데 단추로 누르면 예전처럼 링크(새 탭·다운로드)로.
document.addEventListener("click", function (e) {
const a = e.target.closest && e.target.closest("a.pj-comment-att-img, .pj-chat-att-img a");
@@ -2453,7 +2470,7 @@
const img = a.querySelector("img");
if (!img) return;
e.preventDefault();
openImageWindow(img, { actual: true, download: a.getAttribute("href"), name: img.getAttribute("alt") || a.getAttribute("title") || "" });
openImageWindow(img, { fill: true, download: a.getAttribute("href"), name: img.getAttribute("alt") || a.getAttribute("title") || "" });
});
// ── 댓글·답글 입력칸 — 전송·붙여넣기 뒤에도 70px 고정, 긴 글은 내부 스크롤.
+25 -4
View File
@@ -1,5 +1,6 @@
// 실제 브라우저 — 업무 창 댓글에 붙은 사진을 누르면 내려받지 않고 이미지 창(별도 브라우저 창)이 열린다(2026-10-22).
// 처음 100%(창보다 커도), 끌어서 이동, 휠 확대·축소, [원본 보기] = 100% 로, [다운로드] = 첨부 다운로드 주소. Ctrl+클릭은 예전처럼 링크.
// 처음 = 맞춤으로 창에 꽉 참(가장자리 검은 공간 없음, 창 크기를 바꿔도 맞춤 유지), 끌어서 이동, 휠 확대·축소, [원본 보기] = 100%,
// [다운로드] = 첨부 다운로드 주소. Ctrl+클릭은 예전처럼 링크. (2026-10-22 — 처음 100% 에서 맞춤으로 바꿈)
// python tests/js/render_project.py
// NODE_PATH=<playwright 경로> PJ_TEST_BROWSER=<Chrome 경로> node tests/js/comment_image_viewer.browser.test.js
const assert = require("node:assert/strict");
@@ -74,15 +75,28 @@ const server = http.createServer(async (req, res) => {
ok("누르면 내려받지 않고 이미지 창이 열림", downloads.length === 0 && pop !== page);
const st = () => pop.evaluate(() => ({ pct: document.getElementById("pct").textContent, tr: document.getElementById("img").style.transform,
title: document.title, w: innerWidth, h: innerHeight }));
// 사진이 창을 꽉 채우나 — 사진 사각형이 창의 한 축을 꽉 채우고 다른 축도 비율대로(이 창은 1600×1000 = 사진과 같은 비율이라 둘 다)
const filled = () => pop.evaluate(() => { const r = document.getElementById("img").getBoundingClientRect();
return { l: Math.round(r.left), t: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height), W: innerWidth, H: innerHeight }; });
const s0 = await st();
ok("처음 100%(사진 1600×1000 이 창보다 커도), 창 제목 = 파일 이름", s0.pct === "100%" && s0.title === "photo.png" && (s0.w < 1600 || s0.h < 1000), s0);
const f0 = await filled();
ok("처음 = 맞춤, 사진이 창에 꽉 참(가장자리 검은 공간 없음), 창 제목 = 파일 이름",
s0.title === "photo.png" && f0.l === 0 && f0.t === 0 && f0.w === f0.W && f0.h === f0.H, { s0: s0, f0: f0 });
await pop.setViewportSize({ width: 800, height: 500 });
await pop.waitForTimeout(100);
const f1 = await filled();
ok("창 크기를 바꿔도 맞춤 유지(꽉 참)", f1.l === 0 && f1.t === 0 && f1.w === 800 && f1.h === 500 && (await st()).pct === "50%", f1);
await pop.setViewportSize({ width: 1600, height: 1000 });
await pop.waitForTimeout(100);
await pop.click("#one");
const s0b = await st();
const box = await pop.locator("#stage").boundingBox();
await pop.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
await pop.mouse.down();
await pop.mouse.move(box.x + box.width / 2 + 150, box.y + box.height / 2 + 80, { steps: 5 });
await pop.mouse.up();
const s1 = await st();
ok("끌면 이미지가 움직임(100% 그대로)", s1.tr !== s0.tr && s1.pct === "100%", { before: s0.tr, after: s1.tr });
ok("끌면 이미지가 움직임(100% 그대로)", s1.tr !== s0b.tr && s1.pct === "100%", { before: s0b.tr, after: s1.tr });
await pop.mouse.wheel(0, -300);
const s2 = await st();
await pop.mouse.wheel(0, 600);
@@ -91,7 +105,14 @@ const server = http.createServer(async (req, res) => {
await pop.click("#one");
ok("[원본 보기] = 100% 로", (await st()).pct === "100%" && (await pop.locator("#one").textContent()).trim() === "원본 보기");
await pop.click("#fit");
ok("[맞춤] = 창에 맞춤(100% 아래)", parseInt((await st()).pct, 10) < 100);
const fz = await filled();
ok("[맞춤] = 다시 창에 꽉 참", fz.l === 0 && fz.t === 0 && fz.w === fz.W && fz.h === fz.H, fz);
await pop.mouse.move(800, 400); // 막대 위가 아니라 사진 위에서 휠
await pop.mouse.wheel(0, -300);
await pop.setViewportSize({ width: 1200, height: 900 });
await pop.waitForTimeout(100);
ok("확대한 뒤엔 창 크기를 바꿔도 맞춤으로 돌아가지 않음", (await st()).pct !== "75%");
await pop.setViewportSize({ width: 1600, height: 1000 });
const dlHref = await pop.getAttribute("#dl", "href");
ok("[다운로드] = 첨부 다운로드 주소", /\/project\/api\/attachments\/7\/download$/.test(dlHref || ""), dlHref);
const [download] = await Promise.all([pop.waitForEvent("download"), pop.click("#dl")]);
+6
View File
@@ -35,6 +35,11 @@ async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: page(file) });
});
await p.goto("http://perf.test/performance/");
// 칸 풍선 도움말 없음(2026-10-22) — 표 몸통 칸(날짜·금액·광고비 줄)과 그 안 어디에도 title 이 없다(열 머리글은 그대로)
const tips = await p.evaluate(function () {
return Array.from(document.querySelectorAll(".perf-main tbody [title]")).map(function (n) { return n.tagName + ":" + n.getAttribute("title"); });
});
check(label + " 표 칸에 풍선 도움말(title) 없음", tips.length === 0, tips.slice(0, 5));
const td = '[data-manual-code="' + code + '"][data-date="' + day + '"]';
// 표를 스크롤하면 열린 메뉴는 닫힌다(사람은 스크롤한 뒤 우클릭) — 오른쪽 끝 열(기타광고비)은 먼저 보이게 스크롤해 둔다
const show = async function (sel) { await p.locator(sel).scrollIntoViewIfNeeded(); await p.waitForTimeout(80); };
@@ -81,6 +86,7 @@ async function memoFlow(browser, file, kind, code, day, hasMemo, label) {
await p.click(".perf-ctx button.is-danger");
await p.waitForFunction(function (sel) { return !document.querySelector(sel).classList.contains("has-memo"); }, td);
check(label + " 메모 삭제 → 빈 메모로 저장, 표시 사라짐", puts[puts.length - 1].memo === "");
check(label + " 저장한 뒤에도 칸에 풍선 도움말 없음", !(await p.getAttribute(td, "title")));
// 칸 왼쪽 클릭은 예전처럼 금액 입력
await p.click(td);
check(label + " 칸 클릭은 그대로 금액 입력", !!(await p.$(td + " .perf-manual-input")));