feat(project): add font options and selected goal text formatting

Restore the board header add button to the task side panel while keeping footer quick entry. Add safe, persisted goal text formatting and self-hosted Project font preferences with shared help updates and regression coverage.
This commit is contained in:
2026-10-02 17:28:54 +09:00
parent 035cb83d6f
commit 20232baf06
39 changed files with 756 additions and 54 deletions
+2 -2
View File
@@ -2392,9 +2392,9 @@ class ProjectStore:
"SELECT row_id, month, body FROM goal_cells WHERE row_id = ANY(%s) AND month = ANY(%s)",
(rows_in, cols_in),
).fetchall()}
text = store.validate_goal_text("\n".join(
text = store.merge_goal_texts([
bodies[(r, m)] for r in rows_in for m in cols_in if bodies.get((r, m))
))
])
conn.execute(
"DELETE FROM goal_cell_merges WHERE row_id = ANY(%s) AND start_month = ANY(%s)",
(rows_in, cols_in),
+3 -2
View File
@@ -2567,7 +2567,8 @@ def _goal_area_layout(rows: list[dict[str, Any]], this_month: int) -> None:
kind = "year" if m == store.GOAL_YEAR else "quarter" if m in store.GOAL_COL_QUARTER else "month"
h = 0 if kind == "year" else store.GOAL_COL_QUARTER[m] if kind == "quarter" else store.goal_quarter_of(m)
out.append({"m": m, "kind": kind, "h": h, "span": span, "rspan": rspan,
"now": kind == "month" and m <= this_month <= m + span - 1})
"now": kind == "month" and m <= this_month <= m + span - 1,
"html": store.goal_text_html(row.get("cells", {}).get(m, ""))})
row["layout"] = out
@@ -3062,7 +3063,7 @@ def _month_plan(st: Any, year: int, month: int) -> list[dict[str, Any]] | None:
if not row.get("label_cont"):
label = row.get("label") or ""
cell = next((c for c in row["layout"] if c["kind"] == "month" and c["m"] <= month <= c["m"] + c["span"] - 1), None)
text = (row["cells"].get(cell["m"], "") if cell else "").strip()
text = store.goal_text_plain(row["cells"].get(cell["m"], "") if cell else "").strip()
if not text:
continue
rng = f"{cell['m']}~{cell['m'] + cell['span'] - 1}월" if cell["span"] > 1 else ""
+74
View File
@@ -6,8 +6,10 @@ DB 없이 단위 테스트 가능한 순수 함수만 둔다(malaysia.store 패
from __future__ import annotations
import json
import re
from datetime import date, timedelta
from html import escape
from html.parser import HTMLParser
from typing import Any
@@ -475,11 +477,83 @@ def validate_goal_color(color: Any) -> str:
def validate_goal_text(body: Any) -> str:
v = str(body or "").replace("\r\n", "\n").strip()
if v.startswith(GOAL_RICH_PREFIX):
runs = goal_text_runs(v, strict=True)
if not "".join(r["text"] for r in runs).strip():
return ""
return GOAL_RICH_PREFIX + json.dumps(runs, ensure_ascii=False, separators=(",", ":"))
if len(v) > GOAL_TEXT_MAX:
raise ValueError(f"칸 하나에 {GOAL_TEXT_MAX}자까지 쓸 수 있습니다.")
return v
# 기존 TEXT 칸에 버전이 있는 텍스트 조각을 저장한다. 예전 평문은 그대로 유지한다.
GOAL_RICH_PREFIX = "pj-rich:v1:"
def goal_text_runs(body: Any, *, strict: bool = False) -> list[dict[str, Any]]:
value = str(body or "")
if not value.startswith(GOAL_RICH_PREFIX):
return [{"text": value}]
try:
raw = json.loads(value[len(GOAL_RICH_PREFIX):])
if not isinstance(raw, list) or len(raw) > GOAL_TEXT_MAX:
raise ValueError("서식 데이터가 올바르지 않습니다.")
runs = []
for item in raw:
if not isinstance(item, dict) or not isinstance(item.get("text"), str):
raise ValueError("서식 데이터가 올바르지 않습니다.")
run: dict[str, Any] = {"text": item["text"]}
if isinstance(item.get("bold"), bool):
run["bold"] = item["bold"]
if re.fullmatch(r"#[0-9a-fA-F]{6}", str(item.get("color", ""))):
run["color"] = item["color"].lower()
size = item.get("size")
if isinstance(size, int) and not isinstance(size, bool) and 10 <= size <= 32:
run["size"] = size
if run["text"]:
runs.append(run)
if sum(len(r["text"]) for r in runs) > GOAL_TEXT_MAX:
raise ValueError(f"칸 하나에 {GOAL_TEXT_MAX}자까지 쓸 수 있습니다.")
return runs
except (ValueError, TypeError) as err:
if strict:
raise ValueError("칸의 서식 데이터가 올바르지 않습니다.") from err
return [{"text": value}]
def goal_text_plain(body: Any) -> str:
return "".join(r["text"] for r in goal_text_runs(body))
def goal_text_html(body: Any) -> str:
"""허용한 글자 서식만 HTML로 만든다. 사용자 텍스트는 항상 escape한다."""
out = []
for run in goal_text_runs(body):
style = []
if "bold" in run:
style.append("font-weight:" + ("700" if run["bold"] else "400"))
if "color" in run:
style.append("color:" + run["color"])
if "size" in run:
style.append(f'font-size:{run["size"]}px')
text = escape(run["text"])
out.append(f'<span style="{";".join(style)}">{text}</span>' if style else text)
return "".join(out)
def merge_goal_texts(bodies: list[str]) -> str:
values = [v for v in bodies if goal_text_plain(v).strip()]
if not any(v.startswith(GOAL_RICH_PREFIX) for v in values):
return validate_goal_text("\n".join(values))
runs = []
for value in values:
if runs:
runs.append({"text": "\n"})
runs.extend(goal_text_runs(value))
return validate_goal_text(GOAL_RICH_PREFIX + json.dumps(runs, ensure_ascii=False))
# ── 엑셀식 사각형 병합(마이그레이션 015) ──────────────────────────────
class GoalMigration015Needed(RuntimeError):
"""세로 병합·주간 회의록은 마이그레이션 015 뒤에만 된다."""
@@ -34,3 +34,4 @@
title="프로젝트 관리 도움말" aria-label="프로젝트 관리 도움말">
<span class="material-symbols-outlined">help</span>
</a>
{% include "project/_options.html" %}
@@ -0,0 +1,31 @@
<button type="button" class="pj-help-btn" id="pj-options-btn" aria-label="Project 옵션" title="Project 옵션">
<span class="material-symbols-outlined">settings</span>
</button>
<dialog class="pj-options-dialog" id="pj-options-dialog" aria-labelledby="pj-options-title">
<form id="pj-options-form">
<h2 id="pj-options-title">Project 옵션</h2>
<label for="pj-options-font">폰트</label>
<select id="pj-options-font" name="font">
<option value="system">기본 시스템 폰트</option>
<option value="pretendard">프리텐다드</option>
<option value="nanum-square">나눔 스퀘어</option>
<option value="nanum-square-neo">나눔 스퀘어 네오</option>
<option value="nanum-square-round">나눔 스퀘어 라운드</option>
</select>
<div class="pj-options-preview" id="pj-options-preview">프로젝트와 목표를 한눈에<br><b>Project · 업무 이름 · 가나다 123</b></div>
<p>이 브라우저의 모든 Project 화면에 적용됩니다.</p>
<p class="pj-options-error" id="pj-options-error" role="alert" hidden></p>
<div class="pj-options-actions">
<button type="button" class="pj-btn" id="pj-options-cancel">취소</button>
<button type="submit" class="pj-btn pj-btn-primary" id="pj-options-save">저장</button>
</div>
</form>
</dialog>
<script>
try {
var pf = localStorage.getItem("pj_font") || "system";
if (["system", "pretendard", "nanum-square", "nanum-square-neo", "nanum-square-round"].indexOf(pf) >= 0)
document.documentElement.dataset.pjFont = pf;
} catch (_) {}
</script>
<script src="/static/project-options.js?v=20261002g" defer></script>
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -296,5 +296,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002f" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -37,6 +37,15 @@
{% endif %}
</div>
{% if is_admin and goals_enabled and board %}
<div class="pj-goal-format" id="pj-goal-format" role="toolbar" aria-label="선택한 글자 서식">
<span>글자를 드래그해 선택한 뒤 서식을 변경하세요.</span>
<label>색상 <input type="color" value="#1e1f21" data-goal-format="color" aria-label="글자 색상" disabled></label>
<label>굵기 <select data-goal-format="bold" aria-label="글자 굵기" disabled><option value="400">보통</option><option value="700">굵게</option></select></label>
<label>크기 <select data-goal-format="size" aria-label="글자 크기" disabled>{% for size in (10, 12, 14, 16, 18, 20, 24, 28, 32) %}<option value="{{ size }}"{% if size == 14 %} selected{% endif %}>{{ size }}px</option>{% endfor %}</select></label>
<button type="button" class="pj-btn" data-goal-format="reset" disabled>서식 초기화</button>
</div>
{% endif %}
<div class="pj-view pj-goal-pane" id="pj-goal-pane">
{% if not goals_enabled %}
<div class="pj-empty">연간 목표가 아직 준비되지 않았습니다(DB 마이그레이션 013 필요).</div>
@@ -166,10 +175,11 @@
{% if c.kind in ('month', 'quarter') %}data-h="{{ c.h }}" {% endif %}data-month="{{ c.m }}" data-span="{{ c.span }}" data-rspan="{{ c.rspan }}"
{%- if c.span > 1 %} colspan="{{ c.span }}" style="--span: {{ c.span }}"{% endif %}{% if c.rspan > 1 %} rowspan="{{ c.rspan }}"{% endif %}>
{%- if editable -%}
<textarea class="pj-goal-text" rows="1" data-row="{{ row.id }}" data-month="{{ c.m }}"
placeholder="{{ '연간 목표' if c.m == 0 else ((c.h ~ '분기 목표') if c.kind == 'quarter' else '') }}">{{ row.cells.get(c.m, '') }}</textarea>
<div class="pj-goal-text" contenteditable="true" role="textbox" aria-multiline="true" aria-label="목표 내용"
data-row="{{ row.id }}" data-month="{{ c.m }}"
data-placeholder="{{ '연간 목표' if c.m == 0 else ((c.h ~ '분기 목표') if c.kind == 'quarter' else '') }}">{{ c.html|safe }}</div>
{%- else -%}
<div class="pj-goal-text-ro">{{ row.cells.get(c.m, '') }}</div>
<div class="pj-goal-text-ro">{{ c.html|safe }}</div>
{%- endif -%}
</td>
{% endfor %}
@@ -181,7 +191,7 @@
{% if is_admin %}
<div class="pj-goal-foot">
<button type="button" class="pj-btn" id="pj-goal-area-add">+ 업무 영역 추가</button>
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하거나 칸의 ⋮ 버튼(키보드 Tab·Enter, 터치)을 누르면 색·순서·줄 추가·삭제 메뉴가 나옵니다.
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 글자를 드래그해 선택하면 표 위에서 색상·굵기·크기를 바꾸거나 서식을 초기화할 수 있습니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하거나 칸의 ⋮ 버튼(키보드 Tab·Enter, 터치)을 누르면 색·순서·줄 추가·삭제 메뉴가 나옵니다.
{%- if board.halves %} 칸을 마우스로 끌어 여러 칸을 고른 뒤 우클릭 → 셀 병합, 병합된 칸은 우클릭 → 병합 해제(글은 왼쪽 위 칸에 남음).{% endif %}
월 이름을 누르면 그 달 주간 회의록이 열립니다.</span>
</div>
@@ -196,5 +206,6 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002f" defer></script>
<script src="/static/project-goal-text.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project-help.css?v=20261002d" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -78,7 +78,7 @@
<section class="pjh-sec" id="layout">
<h2><span class="pjh-num">2</span>화면 구성</h2>
<div class="pjh-map" aria-hidden="true">
<div class="pjh-map-top"><span><b>위쪽 바</b>화면 이름</span><span>🔔 알림 · 내 이름 · 로그아웃 · <b style="display:inline">?</b> 도움말</span></div>
<div class="pjh-map-top"><span><b>위쪽 바</b>화면 이름</span><span>🔔 알림 · 내 이름 · 로그아웃 · <b style="display:inline">?</b> 도움말 · 옵션</span></div>
<div class="pjh-map-side"><b>왼쪽 사이드바</b>전체 검색<br>수신함 · 내 작업 · 휴지통 · 목표<br>프로젝트 목록<br>완료 프로젝트<br>전체 멤버</div>
<div class="pjh-map-main"><b>가운데 작업 영역</b>왼쪽 위: 프로젝트 제목 · 멤버<br>그 아래: 보기 탭(보드 · 목록 · 캘린더 · 타임라인 · 대시보드)<br>오른쪽 위: 범위(이 프로젝트 / 전체 프로젝트)<br>필터 바<br>작업들</div>
</div>
@@ -94,7 +94,9 @@
<b>달성</b>은 실적÷목표(100% 이상 초록)로 저절로 계산됩니다. 분기 칸 머리의 <b>‹</b> 버튼을 누르면 그 분기의 월 칸 3개가
접히고, 다시 누르면 펼쳐집니다(접힌 상태는 내 브라우저에 기억). 월 이름을 누르면 그 달 <b>주간 회의록</b>이 열립니다.
<b>입력은 관리자만</b> 할 수 있고(칸을 고치면 바로 저장), 다른 직원은 보기만 합니다. 관리자는 <b>+ 연도 추가</b>로 새해 목표를
만들고(이전 연도의 업무 영역 구성을 그대로 가져옴), 영역·줄 이름은 <b>눌러서 그 자리에서 고치고</b>(Enter 저장, Esc 취소),
만듭니다(이전 연도의 업무 영역 구성을 그대로 가져옴). 글 칸에서 <b>글자를 드래그해 선택</b>하고 표 위 서식 도구로 <b>색상·굵기·크기</b>를 바꾸면 선택한 글자에만 적용됩니다.
<span class="pjh-ui">서식 초기화</span>는 선택한 글자를 기본 서식으로 되돌리며 내용은 유지합니다. 서식도 자동으로 저장됩니다.
영역·줄 이름은 <b>눌러서 그 자리에서 고치고</b>(Enter 저장, Esc 취소),
구역·항목 칸을 <b>우클릭</b>하거나 칸 오른쪽 위의 작은 <span class="pjh-ui">⋮</span> 버튼(마우스를 올리면 보임)을 눌러 색·순서·줄 추가·삭제를 합니다.
키보드로는 <kbd>Tab</kbd>으로 이름 칸·<span class="pjh-ui">⋮</span>로 가서 <kbd>Enter</kbd>(이름 칸 = 이름 고치기, ⋮ = 메뉴), 메뉴 안에서 <kbd>↑</kbd><kbd>↓</kbd>·<kbd>Enter</kbd>,
<kbd>Esc</kbd>로 닫습니다. 터치 화면에서는 ⋮ 버튼이 늘 옅게 보여 손가락으로 누르면 됩니다. 업무 영역 칸은 엑셀처럼 <b>병합</b>할 수 있습니다 — 칸을 마우스로
@@ -116,6 +118,8 @@
<li><span class="pjh-ui"><span class="material-symbols-outlined">notifications</span></span> 종 아이콘 — 읽지 않은 알림 수가 표시되고, 누르면 수신함으로 갑니다.</li>
<li><span class="pjh-ui"><span class="material-symbols-outlined">fit_screen</span></span> 화면 배율 — 누르면(파랗게 켜짐) 화면 전체를 75%로 줄입니다. 2880×1620 모니터를 Windows 배율 200%로 쓰면 화면이 꽉 차 보이는데, 이때 켜면 1920×1080 모니터와 같은 모습이 됩니다. 브라우저마다 기억합니다. 메뉴·말풍선 같은 작은 팝업은 원래 크기로 뜹니다.</li>
<li><span class="pjh-ui"><span class="material-symbols-outlined">help</span></span> 물음표 — 지금 보고 있는 이 도움말을 새 탭으로 엽니다.</li>
<li><span class="pjh-ui"><span class="material-symbols-outlined">settings</span></span> 도움말 오른쪽의 옵션 — 폰트를 고르고 미리 본 뒤 <span class="pjh-ui">저장</span>을 누르면 Project 화면에 적용되고 창이 닫힙니다.
기본 시스템 폰트·프리텐다드·나눔 스퀘어·나눔 스퀘어 네오·나눔 스퀘어 라운드 중 선택할 수 있습니다. 설정은 이 브라우저의 모든 Project 화면에서 기억합니다. <span class="pjh-ui">취소</span>는 변경을 적용하지 않고 닫습니다.</li>
</ul>
<h3>프로젝트 제목</h3>
<p>가운데 위 프로젝트 제목에 마우스를 올리면 테두리가 생깁니다. 누르면 그 자리에서 이름을 고칩니다 — <kbd>Enter</kbd>나 바깥을 누르면 저장, <kbd>Esc</kbd>는 취소. (그 프로젝트 멤버·관리자만)</p>
@@ -232,7 +236,8 @@
<div><b>기본 담당자</b>를 정해 두면, 그 섹션에 담당자 없는 작업을 새로 만들거나 옮겨 올 때 그 사람이 자동으로 담당자가 됩니다. 예) “검토” 섹션의 기본 담당자 = 팀장.</div></div>
<h3>작업 카드 다루기</h3>
<ul>
<li><b>작업 추가</b> — 섹션 머리의 <span class="pjh-ui">+</span> 또는 섹션 맨 아래 <span class="pjh-ui">+ 작업 추가</span>를 누르면 보드 안에 입력 카드가 나타납니다. <b>작업 이름·담당자·마감일</b>을 정한 뒤 <kbd>Enter</kbd>를 누르거나 카드 밖을 클릭하면 저장됩니다. Enter로 저장하면 다음 작업을 계속 입력할 수 있고, <kbd>Esc</kbd>로 취소할 수 있습니다.</li>
<li><b>상단 작업 추가</b> — 섹션 머리의 <span class="pjh-ui">+</span>는 오른쪽에서 작업 상세창을 엽니다. 제목·설명·담당자·우선순위·마감일을 설정할 수 있습니다.</li>
<li><b>하단 작업 추가</b> — 섹션 맨 아래 <span class="pjh-ui">+ 작업 추가</span>는 보드 안에 간단한 입력 카드를 엽니다. <b>작업 이름·담당자·마감일</b>을 정한 뒤 <kbd>Enter</kbd>를 누르거나 카드 밖을 클릭하면 저장됩니다. Enter로 저장하면 다음 작업을 계속 입력할 수 있고, <kbd>Esc</kbd>로 취소할 수 있습니다.</li>
<li><b>열기</b> — 카드를 누르면 오른쪽에 작업 편집 창이 열립니다. (<a href="#task">8장</a>)</li>
<li><b>담당자·마감일 바로 바꾸기</b> — 카드의 사람 아이콘이나 날짜를 누르면 그 자리에서 바꿉니다. 비어 있으면 카드에 마우스를 올렸을 때 점선 원 아이콘이 나타납니다.</li>
<li><b>옮기기</b> — 카드를 끌어 다른 섹션에 놓으면 섹션이 바뀌고, 같은 섹션 안에서 위아래로 놓으면 순서가 바뀝니다.</li>
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -104,5 +104,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002f" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<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=20261002f" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -496,5 +496,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261002f" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002f" />
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<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=20261002f" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
{% endblock %}
+10
View File
@@ -0,0 +1,10 @@
@font-face { font-family: "Pretendard Variable"; src: url("vendor/project-fonts/PretendardVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquare"; src: url("vendor/project-fonts/NanumSquareR.woff") format("woff"); font-weight: 100 599; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquare"; src: url("vendor/project-fonts/NanumSquareB.woff") format("woff"); font-weight: 600 749; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquare"; src: url("vendor/project-fonts/NanumSquareEB.woff") format("woff"); font-weight: 750 900; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareNeo"; src: url("vendor/project-fonts/NanumSquareNeoR.woff") format("woff"); font-weight: 100 599; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareNeo"; src: url("vendor/project-fonts/NanumSquareNeoB.woff") format("woff"); font-weight: 600 749; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareNeo"; src: url("vendor/project-fonts/NanumSquareNeoEB.woff") format("woff"); font-weight: 750 900; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("vendor/project-fonts/NanumSquareRoundR.woff2") format("woff2"); font-weight: 100 599; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("vendor/project-fonts/NanumSquareRoundB.woff2") format("woff2"); font-weight: 600 749; font-style: normal; font-display: swap; }
@font-face { font-family: "NanumSquareRound"; src: url("vendor/project-fonts/NanumSquareRoundEB.woff2") format("woff2"); font-weight: 750 900; font-style: normal; font-display: swap; }
+170
View File
@@ -0,0 +1,170 @@
/* 목표 셀의 선택한 글자 서식. 서버와 같은 버전 있는 텍스트 조각을 사용한다. */
(function () {
"use strict";
const PREFIX = "pj-rich:v1:";
function styles(node, inherited) {
const s = Object.assign({}, inherited);
if (node.nodeType !== 1) return s;
const css = node.style;
if (node.tagName === "B" || node.tagName === "STRONG") s.bold = true;
if (css.fontWeight) s.bold = css.fontWeight === "bold" || Number(css.fontWeight) >= 600;
const size = parseInt(css.fontSize, 10);
if (size >= 10 && size <= 32) s.size = size;
if (css.color) {
const rgb = css.color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
const hex = rgb ? "#" + rgb.slice(1).map(function (v) { return Number(v).toString(16).padStart(2, "0"); }).join("") : css.color;
if (/^#[\da-f]{6}$/i.test(hex)) s.color = hex.toLowerCase();
}
return s;
}
function readRuns(editor) {
const runs = [];
function add(text, style) { if (text) runs.push(Object.assign({ text: text }, style)); }
function walk(node, inherited) {
if (node.nodeType === 3) { add(node.nodeValue, inherited); return; }
if (node.nodeType !== 1) return;
if (node.tagName === "BR") { add("\n", inherited); return; }
if (/^(SCRIPT|STYLE|IMG|IFRAME)$/.test(node.tagName)) return;
const style = styles(node, inherited);
const block = /^(DIV|P)$/.test(node.tagName);
if (block && runs.length && !runs[runs.length - 1].text.endsWith("\n")) add("\n", inherited);
Array.from(node.childNodes).forEach(function (child) { walk(child, style); });
}
Array.from(editor.childNodes).forEach(function (child) { walk(child, {}); });
return compact(runs);
}
function compact(runs) {
const out = [];
runs.forEach(function (run) {
if (!run.text) return;
const prev = out[out.length - 1];
if (prev && prev.bold === run.bold && prev.color === run.color && prev.size === run.size) prev.text += run.text;
else out.push(Object.assign({}, run));
});
return out;
}
function encode(runs) {
runs = compact(runs);
return runs.some(function (r) { return Object.keys(r).length > 1; }) ? PREFIX + JSON.stringify(runs) : runs.map(function (r) { return r.text; }).join("");
}
function decode(value) {
if (value.startsWith(PREFIX)) {
try { const runs = JSON.parse(value.slice(PREFIX.length)); if (Array.isArray(runs)) return runs; } catch (_) {}
}
return [{ text: value }];
}
function paint(editor, runs) {
editor.replaceChildren();
runs.forEach(function (r) {
if (typeof r.text !== "string") return;
const span = document.createElement("span");
span.textContent = r.text;
if (typeof r.bold === "boolean") span.style.fontWeight = r.bold ? "700" : "400";
if (/^#[\da-f]{6}$/i.test(r.color || "")) span.style.color = r.color;
if (Number.isInteger(r.size) && r.size >= 10 && r.size <= 32) span.style.fontSize = r.size + "px";
editor.appendChild(span.style.cssText ? span : document.createTextNode(r.text));
});
}
function restore(editor, start, end) {
const walker = document.createTreeWalker(editor, NodeFilter.SHOW_TEXT);
const points = [], range = document.createRange();
let node, offset = 0;
while ((node = walker.nextNode())) {
points.push({ node: node, start: offset, end: offset + node.length }); offset += node.length;
}
function point(n) { return points.find(function (p) { return n <= p.end; }) || points[points.length - 1]; }
const a = point(start), b = point(end);
if (!a || !b) { range.selectNodeContents(editor); range.collapse(false); }
else { range.setStart(a.node, Math.max(0, start - a.start)); range.setEnd(b.node, Math.max(0, end - b.start)); }
const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range);
return range;
}
function attach(editor) {
// 기존 자동 저장·병합·초안 복구와 같은 value 인터페이스를 제공한다.
Object.defineProperty(editor, "value", { configurable: true,
get: function () { return encode(readRuns(editor)); },
set: function (v) { paint(editor, decode(String(v || ""))); },
});
editor.addEventListener("keydown", function (e) {
if (e.isComposing || e.keyCode === 229) return;
if (e.key === "Enter") { e.preventDefault(); insert(editor, "\n"); }
});
editor.addEventListener("paste", function (e) {
e.preventDefault(); insert(editor, e.clipboardData.getData("text/plain"));
});
}
function insert(editor, text) {
const sel = window.getSelection();
if (!sel.rangeCount || !editor.contains(sel.getRangeAt(0).commonAncestorContainer)) return;
const range = sel.getRangeAt(0); range.deleteContents();
const node = document.createTextNode(text); range.insertNode(node);
range.setStartAfter(node); range.collapse(true); sel.removeAllRanges(); sel.addRange(range);
editor.dispatchEvent(new Event("input", { bubbles: true }));
}
function init(table, toolbar) {
if (!toolbar) return;
let saved = null;
function clear() {
saved = null;
toolbar.querySelectorAll("button, input, select").forEach(function (el) { el.disabled = true; });
}
function capture() {
// 서식 도구에 포커스를 옮길 때는 직전 글자 선택을 유지한다.
if (toolbar.contains(document.activeElement)) return;
const sel = window.getSelection();
if (!sel.rangeCount || sel.isCollapsed) { clear(); return; }
const range = sel.getRangeAt(0);
const root = range.startContainer.nodeType === 1 ? range.startContainer : range.startContainer.parentElement;
const editor = root.closest(".pj-goal-text[contenteditable='true']");
if (!editor || !table.contains(editor) || !editor.contains(range.endContainer)) { clear(); return; }
const pre = document.createRange(); pre.selectNodeContents(editor); pre.setEnd(range.startContainer, range.startOffset);
saved = { editor: editor, start: pre.toString().length, end: pre.toString().length + range.toString().length };
toolbar.querySelectorAll("button, input, select").forEach(function (el) { el.disabled = false; });
let pos = 0;
const chosen = readRuns(editor).filter(function (run) {
const end = pos + run.text.length, intersects = end > saved.start && pos < saved.end;
pos = end; return intersects;
});
function uniform(key, fallback) {
const value = chosen[0] && chosen[0][key];
return chosen.every(function (r) { return r[key] === value; }) && value !== undefined ? value : fallback;
}
toolbar.querySelector("[data-goal-format='bold']").value = uniform("bold", false) ? "700" : "400";
toolbar.querySelector("[data-goal-format='color']").value = uniform("color", "#1e1f21");
toolbar.querySelector("[data-goal-format='size']").value = String(uniform("size", 14));
}
document.addEventListener("selectionchange", capture);
table.addEventListener("mouseup", capture);
table.addEventListener("keyup", capture);
toolbar.addEventListener("mousedown", function (e) { if (e.target.closest("button")) e.preventDefault(); });
function apply(key, value) {
if (!saved || !saved.editor.isConnected) return;
const editor = saved.editor, out = []; let pos = 0;
readRuns(editor).forEach(function (run) {
const end = pos + run.text.length;
const a = Math.max(pos, saved.start), b = Math.min(end, saved.end);
if (b <= a) out.push(run);
else {
if (a > pos) out.push(Object.assign({}, run, { text: run.text.slice(0, a - pos) }));
const middle = Object.assign({}, run, { text: run.text.slice(a - pos, b - pos) });
if (key === "reset") { delete middle.color; delete middle.bold; delete middle.size; }
else middle[key] = value;
out.push(middle);
if (b < end) out.push(Object.assign({}, run, { text: run.text.slice(b - pos) }));
}
pos = end;
});
paint(editor, compact(out)); editor.focus(); restore(editor, saved.start, saved.end);
editor.dispatchEvent(new Event("input", { bubbles: true }));
}
toolbar.querySelector("[data-goal-format='color']").addEventListener("input", function (e) { apply("color", e.target.value); });
toolbar.querySelector("[data-goal-format='bold']").addEventListener("change", function (e) { apply("bold", e.target.value === "700"); });
toolbar.querySelector("[data-goal-format='size']").addEventListener("change", function (e) { apply("size", Number(e.target.value)); });
toolbar.querySelector("[data-goal-format='reset']").addEventListener("click", function () { apply("reset"); });
document.addEventListener("mousedown", function (e) {
if (toolbar.contains(e.target) || (saved && saved.editor.contains(e.target))) return;
clear();
}, true);
}
window.PJGoalText = { attach: attach, init: init, readRuns: readRuns, paint: paint, encode: encode };
})();
+40
View File
@@ -0,0 +1,40 @@
(function () {
"use strict";
const button = document.getElementById("pj-options-btn"), dialog = document.getElementById("pj-options-dialog");
if (!button || !dialog || button.dataset.bound) return;
button.dataset.bound = "1";
const names = { system: null, pretendard: "Pretendard Variable", "nanum-square": "NanumSquare",
"nanum-square-neo": "NanumSquareNeo", "nanum-square-round": "NanumSquareRound" };
const select = document.getElementById("pj-options-font"), preview = document.getElementById("pj-options-preview");
const error = document.getElementById("pj-options-error"), save = document.getElementById("pj-options-save");
const cancel = document.getElementById("pj-options-cancel");
function current() { const v = document.documentElement.dataset.pjFont; return Object.hasOwn(names, v) ? v : "system"; }
function paint() {
const font = names[select.value];
preview.style.fontFamily = font ? '"' + font + '", sans-serif' : "var(--pj-system-font)";
}
button.addEventListener("click", function () {
select.value = current(); error.hidden = true; paint(); dialog.showModal(); select.focus();
});
select.addEventListener("change", paint);
cancel.addEventListener("click", function () { if (!save.disabled) dialog.close(); });
dialog.addEventListener("cancel", function (e) { if (save.disabled) e.preventDefault(); });
dialog.addEventListener("close", function () { button.focus(); });
document.getElementById("pj-options-form").addEventListener("submit", async function (e) {
e.preventDefault(); if (save.disabled) return;
const value = select.value, font = names[value];
if (!Object.hasOwn(names, value)) return;
save.disabled = select.disabled = cancel.disabled = true; error.hidden = true;
try {
if (font && document.fonts) {
const loaded = await Promise.all([document.fonts.load('400 14px "' + font + '"', "가나다 Project"), document.fonts.load('700 14px "' + font + '"', "가나다 Project")]);
if (loaded.some(function (list) { return !list.length; })) throw new Error("폰트를 불러오지 못했습니다. 다시 시도해 주세요.");
}
localStorage.setItem("pj_font", value);
document.documentElement.dataset.pjFont = value;
window.dispatchEvent(new Event("resize"));
dialog.close();
} catch (err) { error.textContent = "설정을 저장하지 못했습니다. " + err.message; error.hidden = false; }
finally { save.disabled = select.disabled = cancel.disabled = false; }
});
})();
+29 -4
View File
@@ -1,3 +1,5 @@
@import url("project-fonts.css?v=20261002g");
/* 프로젝트 관리(아사나식) 모듈 스타일.
* 기존 erp.css 토큰(폰트 등) 위에 아사나 느낌의 색·카드·그림자를 별도 변수로
* 얹는다 — 다른 모듈(erp.css)은 그대로 두고 이 모듈(.pj- 클래스)에만 적용. */
@@ -17,9 +19,10 @@
/* 아사나 웹앱 기본 시스템 폰트 + 한글 대체(Apple SD Gothic Neo·Malgun Gothic).
project.css 는 Project 화면에서만 불러오므로 공통 토큰 --font-geist 를 여기서
덮으면 본문·상단바·공용 대화상자(erp-dialog.css)까지 이 화면에서만 바뀐다. */
--pj-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
--pj-system-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
"Helvetica Neue", Helvetica, Arial,
"Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
--pj-font: var(--pj-system-font);
--font-geist: var(--pj-font);
/* 실제 아사나 웹앱에서 측정한 본문/보조/섹션/제목 타이포그래피.
공통 ERP 파일은 유지하고 Project가 불러오는 토큰만 재정의한다. */
@@ -2195,18 +2198,20 @@ th.pj-goal-area-name:focus-within .pj-goal-menu-btn, th.pj-goal-row-label:focus-
.pj-goal-area-text[tabindex]:focus-visible, .pj-goal-row-text[tabindex]:focus-visible { outline: 2px solid var(--pj-accent); outline-offset: 1px; border-radius: 4px; }
html.pj-goal-selecting .pj-goal-menu-btn { pointer-events: none; }
@media print { .pj-goal-menu-btn { display: none !important; } }
textarea.pj-goal-text {
.pj-goal-text {
display: block; width: 100%; box-sizing: border-box; min-height: 46px; padding: 6px; border: none;
white-space: pre-wrap; overflow-wrap: anywhere;
background: transparent; font: inherit; line-height: var(--pj-text-leading); color: inherit; resize: none; overflow: hidden;
}
/* 입력 중인 칸 — 테두리·밝은 배경은 입력칸(글 높이만큼)이 아니라 칸 전체(td)에 */
textarea.pj-goal-text:focus { outline: none; }
.pj-goal-text:focus { outline: none; }
.pj-goal-table td.pj-goal-texttd:focus-within {
box-shadow: inset 0 0 0 2px var(--pj-accent);
background-image: linear-gradient(rgba(255, 255, 255, .75), rgba(255, 255, 255, .75));
}
textarea.pj-goal-text::placeholder { color: rgba(0, 0, 0, .3); }
.pj-goal-text:empty::before { content: attr(data-placeholder); pointer-events: none; color: rgba(0, 0, 0, .3); }
.pj-goal-text-ro { min-height: 46px; padding: 6px; line-height: var(--pj-text-leading); white-space: pre-wrap; overflow-wrap: anywhere; }
.pj-goal-text span, .pj-goal-text-ro span { line-height: normal; }
.pj-goal-area td.is-now { box-shadow: inset 2px 0 0 rgba(123, 104, 238, .35), inset -2px 0 0 rgba(123, 104, 238, .35); }
.pj-goal-texttd.pj-goal-year-col { font-weight: 600; }
/* 가로 스크롤 때 3열(구분·항목·연간)까지 고정 — 연간 열 left = 1열 + 2열 너비, 오른쪽에 경계 그림자.
@@ -2666,3 +2671,23 @@ select.pj-meet-eval[data-v="miss"], .pj-meet-eval-ro[data-v="miss"] { color: #c2
}
/* 댓글 대화창 — 보낼 수 없었던 파일(빈 파일·20MB 초과) */
.pj-chat-pending-chip.is-failed { border-color: #e5484d; background: #fdecea; color: #a1261b; }
html[data-pj-font="pretendard"] { --pj-font: "Pretendard Variable", var(--pj-system-font); }
html[data-pj-font="nanum-square"] { --pj-font: "NanumSquare", var(--pj-system-font); }
html[data-pj-font="nanum-square-neo"] { --pj-font: "NanumSquareNeo", var(--pj-system-font); }
html[data-pj-font="nanum-square-round"] { --pj-font: "NanumSquareRound", var(--pj-system-font); }
.pj-options-dialog { width: min(440px, calc(100vw - 40px)); box-sizing: border-box; padding: 24px; border: 1px solid #d8dce2; border-radius: 12px; color: var(--pj-ink); font-family: var(--pj-font); box-shadow: 0 12px 40px #0003; }
.pj-options-dialog::backdrop { background: #0005; }
.pj-options-dialog h2 { margin: 0 0 22px; font-size: 20px; font-weight: 500; }
.pj-options-dialog label { display: block; margin-bottom: 8px; }
.pj-options-dialog select { width: 100%; padding: 9px; border: 1px solid #d8dce2; border-radius: 6px; font: inherit; }
.pj-options-preview { padding: 18px 12px; margin-top: 16px; border: 1px solid #e5e6e8; border-radius: 6px; font-size: 16px; line-height: 1.7; }
.pj-options-dialog p { font-size: 12px; color: var(--pj-ink-soft); }
.pj-options-dialog .pj-options-error { color: #c22b10; }
.pj-options-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.pj-goal-format { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--pj-border); background: #fff; font-size: 12px; }
.pj-goal-format > span { color: var(--pj-ink-soft); }
.pj-goal-format label { display: flex; align-items: center; gap: 6px; }
.pj-goal-format select { padding: 4px; border: 1px solid #d8dce2; border-radius: 4px; font: inherit; }
.pj-goal-format input[type="color"] { width: 30px; height: 28px; padding: 2px; border: 1px solid #d8dce2; border-radius: 4px; background: #fff; cursor: pointer; }
.pj-goal-format :disabled { opacity: .45; cursor: default; }
+16 -11
View File
@@ -2152,6 +2152,9 @@
win.document.open();
win.document.write(html);
win.document.close();
const fontCSS = win.document.createElement("link"); fontCSS.rel = "stylesheet";
fontCSS.href = new URL("/static/project-fonts.css?v=20261002g", location.href).href; win.document.head.appendChild(fontCSS);
win.document.body.style.fontFamily = getComputedStyle(document.body).fontFamily;
try { win.focus(); } catch (_) {}
}
@@ -4469,7 +4472,7 @@
nameEl.addEventListener("click", function (e) { e.stopPropagation(); startRename(); });
}
const addBtn = col.querySelector(".pj-col-add");
if (addBtn) addBtn.addEventListener("click", function (e) { e.stopPropagation(); openBoardTaskDraft(s); });
if (addBtn) addBtn.addEventListener("click", function (e) { e.stopPropagation(); openTaskModal(null, s.id); });
const moreBtn = col.querySelector(".pj-col-more");
if (moreBtn) moreBtn.addEventListener("click", function (e) {
e.stopPropagation();
@@ -8667,7 +8670,7 @@
syncFoldBtn(h);
if (!animate || reduce) {
cells.forEach(function (c) { c.classList.toggle("is-shrunk", folded); c.classList.toggle("is-gone", folded); });
if (!folded) table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] textarea.pj-goal-text').forEach(fit);
if (!folded) table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] .pj-goal-text').forEach(fit);
return;
}
table.classList.add("is-folding");
@@ -8680,7 +8683,7 @@
}
foldTimers[h] = setTimeout(function () {
if (folded) cells.forEach(function (c) { c.classList.add("is-gone"); });
else table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] textarea.pj-goal-text').forEach(fit);
else table.querySelectorAll('.pj-goal-m[data-h="' + h + '"] .pj-goal-text').forEach(fit);
delete foldTimers[h];
if (!Object.keys(foldTimers).length) table.classList.remove("is-folding");
}, FOLD_MS + 20);
@@ -8705,7 +8708,7 @@
ta.style.height = "auto";
ta.style.height = ta.scrollHeight + "px";
}
function fitAll() { table.querySelectorAll("textarea.pj-goal-text").forEach(fit); }
function fitAll() { table.querySelectorAll(".pj-goal-text").forEach(fit); }
QUARTERS.forEach(function (q) { applyFold(q, false); });
// 병합 선택(Shift+클릭) — 관리자 전용, 아래에서 채운다. 접기 버튼이 먼저 부르므로 여기 둔다.
@@ -8775,9 +8778,10 @@
// 글 칸 연결 — 처음 한 번 + 표를 그 자리에서 다시 그린 뒤 새 칸에(refreshTable). 되살린 초안 수를 돌려준다.
function bindTexts(root) {
let restored = 0, conflict = 0;
root.querySelectorAll("textarea.pj-goal-text").forEach(function (ta) {
root.querySelectorAll(".pj-goal-text").forEach(function (ta) {
if (ta.dataset.bound) return;
ta.dataset.bound = "1";
if (ta.tagName !== "TEXTAREA") window.PJGoalText.attach(ta);
const r = textSaver.track(ta, ta.value);
if (r === "restored") restored++;
else if (r === "conflict") conflict++;
@@ -8789,17 +8793,18 @@
else if (conflict) showToast("다른 곳에서 바뀐 칸 " + conflict + "개는 예전 초안을 되살리지 않았습니다.");
}
bindTexts(table);
window.PJGoalText.init(table, el("pj-goal-format"));
// 칸이 세로로 길어도(옆 칸 글이 길거나 세로 병합) 칸 아무 곳이나 누르면 그 칸 입력 — 커서는 글 끝(엑셀처럼).
// 입력칸(textarea)은 글 높이만큼이라 그 아래를 누르면 아무것도 안 되던 것. Shift+클릭(범위 고르기)·끌기는 그대로.
table.addEventListener("click", function (e) {
if (e.shiftKey || e.button !== 0) return;
const td = e.target.closest("td.pj-goal-texttd");
if (!td || e.target.closest("textarea, input, button, a")) return;
const ta = td.querySelector("textarea.pj-goal-text");
if (!td || e.target.closest(".pj-goal-text, textarea, input, button, a")) return;
const ta = td.querySelector(".pj-goal-text");
if (!ta || ta === document.activeElement) return;
ta.focus();
const n = ta.value.length;
ta.setSelectionRange(n, n);
const range = document.createRange(); range.selectNodeContents(ta); range.collapse(false);
const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range);
});
// 한 줄 안 칸들 높이는 표가 맞춘다 — 창 폭이 바뀌면 글 줄바꿈이 달라지니 다시 잰다.
window.addEventListener("resize", fitAll);
@@ -9324,7 +9329,7 @@
let lastCleared = null; // [[textarea, 예전 글], …]
const clearSel = async function (s) {
const tas = s.cells.filter(function (c) { return hits(c, s); })
.map(function (c) { return c.td.querySelector("textarea.pj-goal-text"); })
.map(function (c) { return c.td.querySelector(".pj-goal-text"); })
.filter(function (ta) { return ta && ta.value !== ""; });
if (!tas.length) return;
lastCleared = tas.map(function (ta) { return [ta, ta.value]; });
@@ -9414,7 +9419,7 @@
items.push({ label: "병합 해제" + (mergedIn.length > 1 ? " (" + mergedIn.length + "곳)" : ""), icon: menuIcon("call_split"),
onClick: function () { clearMergeSel(); unmerge(mergedIn); } });
}
if (inSel.some(function (c) { const t = c.td.querySelector("textarea.pj-goal-text"); return t && t.value; })) {
if (inSel.some(function (c) { const t = c.td.querySelector(".pj-goal-text"); return t && t.value; })) {
items.push({ label: "내용 지우기 (Del)", icon: menuIcon("ink_eraser"), onClick: function () { clearSel(s); } });
}
if (td.dataset.month === "0" && s.n === 1) { // 3열(연간 칸) 하나 우클릭 — 줄 추가·삭제도
+98
View File
@@ -0,0 +1,98 @@
NanumSquare — Copyright 2016 NAVER Corporation. Font designed by Sandoll Communications Inc.
NanumSquareNeo — Copyright 2022 NAVER Corp. Font Designed by Sandoll Inc.
NanumSquareRound — Copyright 2017 NAVER Corporation. Font designed by Sandoll Communications Inc.
Original copyright notices embedded in the unmodified fonts are reproduced in the accompanying *.LICENSE.txt files.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
## SIL OPEN FONT LICENSE
Version 1.1 - 26 February 2007
## PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
## DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
## PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
##TERMINATION
This license becomes null and void if any of the above conditions are
not met.
##DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
Copyright © 2022 NAVER Corp. All rights reserved. Font Designed by Sandoll Inc.
Binary file not shown.
@@ -0,0 +1,5 @@
Copyright ®œ 2016 NAVER Corporation. All rights reserved. Font designed by Sandoll Communications Inc.
NAVER Corporation
www.navercorp.com
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Copyright ®œ 2017 NAVER Corporation. All rights reserved. Font designed by Sandoll Communications Inc.
NAVER Corporation
http://www.navercorp.com
+94
View File
@@ -0,0 +1,94 @@
Copyright (c) 2021, Kil Hyung-jin (https://github.com/orioncactus/pretendard),
with Reserved Font Name Pretendard.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
# Project 웹폰트
Project 옵션에서 선택한 폰트만 브라우저가 불러옵니다. 외부 CDN 요청은 없으며 파일을 수정하지 않았습니다.
- Pretendard Variable 1.3.9: https://github.com/orioncactus/pretendard (SIL OFL 1.1, `Pretendard-LICENSE.txt`)
- NanumSquare / NanumSquareNeo / NanumSquareRound: https://campaign.naver.com/nanumsquare_neo/
네이버 공식 웹폰트 `https://hangeul.pstatic.net/hangeul_static/webfont/`에서 배포하는 원본.
각 폰트에 내장된 저작권 표기는 `*.LICENSE.txt`, OFL 1.1 전문은 `Nanum-OFL.md`에 포함했습니다.
OFL 본문 출처: https://github.com/naver/nanumfont/wiki/Open-Font-License
원본 문서의 NanumGothicCoding 저작권 머리글은 이 폴더에 포함된 세 폰트의 내장 저작권 정보로 바꾸고, 라이선스 본문은 그대로 두었습니다.
Regular / Bold / ExtraBold를 각각 제공하고, Pretendard는 100~900 가변 굵기를 제공합니다.
+15 -2
View File
@@ -12,6 +12,12 @@
**도움말** — `/project/help`(`project/help.html` + `static/project-help.css`), 프로젝트 관리 화면 상단 바 로그아웃
오른쪽 **?** 아이콘(`_help_btn.html`, `erp_base.html` 의 `topbar_after_logout` 블록)으로 새 탭에서 연다. 처음 쓰는 사람용
기능 설명 20장 — **화면 기능을 바꾸면 도움말도 같이 고친다.**
**Project 옵션**(2026-10-02) — 도움말 오른쪽 톱니 버튼(`_options.html` 공통 include)이 native dialog를 연다.
현재 시스템 폰트(기본)·Pretendard Variable·NanumSquare·NanumSquareNeo·NanumSquareRound 중 선택하고 미리보기 → 저장 후 닫기.
`localStorage.pj_font`에 이 브라우저의 선택을 기억하며 모든 Project 화면에서 복원한다. 취소는 적용하지 않는다.
`project.css`의 `--pj-font`만 변경하므로 다른 ERP 화면은 영향을 받지 않으며 아이콘·코드 고정폭 폰트는 유지한다.
폰트는 `static/vendor/project-fonts/`에 원본·저작권/OFL을 함께 보관하고 `project-fonts.css`에서 선언한다(외부 CDN 없음).
저장 시 400/700 글꼴 로딩을 확인하고, 실패하면 이전 설정과 열린 창을 유지해 재시도할 수 있다.
**멤버 이름 표기** — 이메일 아이디의 첫 글자만 대문자(king → King). JS 는 `idOf(email)`/`capName(s)`,
템플릿은 `{{ nm[:1]|upper }}{{ nm[1:] }}` 로 화면에 그릴 때만 바꾼다(API `id`·DB 값은 그대로 — 멘션·검색은 이메일 기준).
**프로젝트 색상·아이콘(아사나식)** — 색상표는 32색(`store.COLOR_PALETTE`, 8칸×4줄 — 위 2줄은 아사나 프로젝트 16색, 아래 2줄은 같은 열의 진한 색. 진한 칸은 체크를 흰색 `.is-dark`. 새 프로젝트
@@ -57,10 +63,11 @@
HTML5 DnD, `PUT /api/projects/{id}/stages/order` 재사용). "전체 프로젝트"
스코프(여러 프로젝트를 섹션 '이름'으로 합쳐 보는 예전 방식)에서는 섹션을
하나로 특정할 수 없어 관리 UI가 없다.
- **보드 빠른 작업 추가**(2026-10-02) — 섹션 머리 `+`·하단 `+ 작업 추가`·섹션 메뉴에서
- **보드 빠른 작업 추가**(2026-10-02) — 하단 `+ 작업 추가`·섹션 메뉴에서
상세창 대신 보드 안에 이름·담당자·마감일 입력 카드가 열린다. Enter는 저장 후 연속 입력,
카드 밖 클릭은 저장 후 닫기, Esc·빈 카드 밖 클릭은 취소. 섹션 기본 담당자를 적용하고,
저장 실패 시 입력을 유지하며 저장 중 반복 제출을 막는다. 기존 작업 생성 API를 재사용한다.
**섹션 머리 `+`는 기존 오른쪽 작업 상세창**(`openTaskModal`)을 열어 제목·설명·담당자·우선순위·마감일을 설정한다.
- **하위 작업(subtask)** — 새 테이블이 아니라 `tasks.parent_task_id` 재사용
(부모 삭제 시 CASCADE). 작업 편집 팝업 안에 인라인으로 표시되며(체크박스+
제목+담당자+마감일, 한 줄에서 바로 저장), 보드/캘린더/목록에는 최상위
@@ -635,7 +642,13 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
(`POST /api/goals/rows/{첫 줄}/split-label` — 이어 붙은 줄들이 각자 빈 이름 항목 칸으로).
- 묶음 첫 줄 삭제 → 바로 아래 이어 붙은 줄이 첫 줄이 되고 이름이 비어 있으면 넘겨받음. 묶인 줄(첫 줄·이어 붙은 줄)과 바꾸는 ↑↓ 이동은 400
(나눈 뒤 이동), 묶음 첫 줄 도구 막대엔 ↑↓ 없음. 새 연도 만들기는 묶음도 복사한다.
- **칸 아무 곳이나 눌러 입력**(엑셀처럼) — 글 칸(textarea)은 글 높이만큼이라, 옆 칸 글이 길거나 세로 병합으로 칸이 길면 아래쪽을 눌러도
- **선택한 글자 서식**(관리자, 2026-10-02) — 목표 업무 영역 글 칸은 `.pj-goal-text[contenteditable]`.
같은 칸의 글자를 드래그해 선택하고 표 위 도구로 색상(`#rrggbb`)·굵기(400/700)·크기(10~32px)를 선택한다.
서식 초기화는 선택 범위의 세 서식만 제거하며 글은 유지한다. 기존 `createFieldSaver`의 자동 저장·실패 재시도·임시 복구를 재사용한다.
`goal_cells.body` TEXT에 `pj-rich:v1:` + JSON 텍스트 조각 배열 `{text,bold?,color?,size?}`를 저장한다(추가 마이그레이션 없음).
평문은 기존 형식 그대로, `store.validate_goal_text`가 허용 서식과 보이는 글자 길이를 검사하고 `goal_text_html`이 글을 escape한 안전한 span만 만든다.
셀 병합은 각 조각 서식을 보존하고, 회의록 월간 계획 추출은 `goal_text_plain`으로 글만 읽는다.
- **칸 아무 곳이나 눌러 입력**(엑셀처럼) — 글 입력칸은 글 높이만큼이라, 옆 칸 글이 길거나 세로 병합으로 칸이 길면 아래쪽을 눌러도
입력이 안 됐다. 이제 업무 영역 글 칸(`td.pj-goal-texttd`)·회의록 글/금액 칸 아무 곳이나 누르면 그 칸 입력으로 들어가고 커서는 글 끝.
칸 전체가 글 입력 마우스 모양. Shift+클릭(범위 고르기)·끌기(병합 선택)는 그대로.
입력 중 테두리·밝은 배경도 입력칸이 아니라 **칸 전체**(`td:focus-within`, 회의록 표도 같음).
+45 -10
View File
@@ -88,6 +88,7 @@ function makeEnv(html, url, opts) {
}
async function boot(env) {
if (env.d.readyState === "loading") await new Promise(function (r) { env.d.addEventListener("DOMContentLoaded", r); });
env.w.eval(fs.readFileSync(path.join(ROOT, "app", "static", "project-goal-text.js"), "utf8"));
env.w.eval(JS);
env.d.dispatchEvent(new env.w.Event("DOMContentLoaded"));
await settle();
@@ -137,16 +138,16 @@ function goalsServer(env, st) {
env.route("GET", /\/project\/goals\/2026$/, async function () {
if (st.getHook) await st.getHook();
st.gets = (st.gets || 0) + 1;
let html = PAGE.goals_admin.replace(/(<textarea class="pj-goal-text"[^>]*data-row="(\d+)" data-month="(\d+)"[^>]*>)([\s\S]*?)(<\/textarea>)/g,
let html = PAGE.goals_admin.replace(/(<div class="pj-goal-text"[^>]*data-row="(\d+)" data-month="(\d+)"[^>]*>)([\s\S]*?)(<\/div>)/g,
function (all, open, row, month, text, close) {
const k = row + ":" + month;
return open + (k in st.cells ? st.cells[k].replace(/&/g, "&amp;").replace(/</g, "&lt;") : text) + close;
return open + (k in st.cells ? renderGoalBody(env, st.cells[k]) : text) + close;
});
if (st.areaAdded) {
html = html.replace(/(<\/tbody>\s*)(<\/table>)/, '$1<tbody class="pj-goal-area" data-area-id="3" data-color="" style="--goal-bg: #fff">' +
'<tr data-row-id="30"><th class="pj-goal-c1 pj-goal-area-name" rowspan="1"><span class="pj-goal-area-text">새 영역</span></th>' +
'<th class="pj-goal-c2 pj-goal-row-label"><span class="pj-goal-row-text"></span></th>' +
'<td class="pj-goal-texttd pj-goal-year-col" data-month="0" data-span="1" data-rspan="1"><textarea class="pj-goal-text" rows="1" data-row="30" data-month="0"></textarea></td>' +
'<td class="pj-goal-texttd pj-goal-year-col" data-month="0" data-span="1" data-rspan="1"><div class="pj-goal-text" contenteditable="true" data-row="30" data-month="0"></div></td>' +
"</tr></tbody>$2");
}
return { text: html };
@@ -154,6 +155,13 @@ function goalsServer(env, st) {
return st;
}
function renderGoalBody(env, value) {
const div = env.d.createElement("div");
const runs = value.startsWith("pj-rich:v1:") ? JSON.parse(value.slice(11)) : [{ text: value }];
env.w.PJGoalText.paint(div, runs);
return div.innerHTML;
}
// ── 가짜 서버 — 회의록 ────────────────────────────────────────────────
function meetServer(env, st) {
st = Object.assign({ items: {}, head: {}, itemHook: null, headHook: null, getHook: null, syncHook: null, page: PAGE.meeting_admin }, st || {});
@@ -368,14 +376,14 @@ function meetServer(env, st) {
const env = makeEnv(PAGE.goals_admin, GOALS_URL, { promptAnswer: "새 영역" });
const st = goalsServer(env, { cellHook: function () { return { status: 503, body: { detail: "temporary save failure" } }; } });
await boot(env);
const ta = env.d.querySelector('textarea.pj-goal-text[data-row="10"][data-month="1"]');
const ta = env.d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
ta.focus(); type(env, ta, "unsaved important plan");
env.d.getElementById("pj-goal-area-add").click();
await settle(); await wait(20); await settle();
check("[3] 글 저장 실패 → 영역 추가 요청 안 보냄", !env.calls.some(function (c) { return c.method === "POST" && /\/areas$/.test(c.url); }),
env.calls.map(function (c) { return c.method + " " + c.url; }));
check("[3] 표를 다시 받지 않음", !st.gets);
check("[3] 미저장 계획 그대로", env.d.querySelector('textarea.pj-goal-text[data-row="10"][data-month="1"]').value === "unsaved important plan");
check("[3] 미저장 계획 그대로", env.d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]').value === "unsaved important plan");
check("[3] 실패 안내", /저장/.test(env.toastText()), env.toastText());
});
await section(async function () { // 진행 중 저장 → 그 저장이 끝난 뒤에 영역 추가, 성공하면 표 교체(새 영역 보임, 저장된 글 유지)
@@ -383,7 +391,7 @@ function meetServer(env, st) {
const gate = deferred();
const st = goalsServer(env, { cellHook: async function () { await gate.promise; } });
await boot(env);
const ta = env.d.querySelector('textarea.pj-goal-text[data-row="10"][data-month="1"]');
const ta = env.d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
ta.focus(); type(env, ta, "plan v2"); ta.blur();
await settle();
env.d.getElementById("pj-goal-area-add").click();
@@ -394,7 +402,7 @@ function meetServer(env, st) {
const order = env.calls.filter(function (c) { return c.method !== "GET" || /goals\/2026$/.test(c.url); }).map(function (c) { return c.method + " " + c.url.replace(/^https?:\/\/[^/]+/, ""); });
check("[3b] 순서: 글 PUT → 영역 POST → 표 GET", order.join(" | ") === "PUT /project/api/goals/rows/10/cells/1 | POST /project/api/goals/2026/areas | GET /project/goals/2026", order);
check("[3b] 새 영역이 그 자리에 보임(새로고침 없음)", !!env.d.querySelector('tbody.pj-goal-area[data-area-id="3"]') && env.navigations === 0);
check("[3b] 저장된 글 유지", env.d.querySelector('textarea.pj-goal-text[data-row="10"][data-month="1"]').value === "plan v2");
check("[3b] 저장된 글 유지", env.d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]').value === "plan v2");
});
await section(async function () { // 표를 받는 사이에 새로 입력 → 저장 후 다시 받아 교체(입력 유실 없음)
const env = makeEnv(PAGE.goals_admin, GOALS_URL, { promptAnswer: "새 영역" });
@@ -404,19 +412,19 @@ function meetServer(env, st) {
await boot(env);
env.d.getElementById("pj-goal-area-add").click();
await settle();
const ta = env.d.querySelector('textarea.pj-goal-text[data-row="11"][data-month="1"]');
const ta = env.d.querySelector('.pj-goal-text[data-row="11"][data-month="1"]');
ta.focus(); type(env, ta, "typed during refresh");
gate.resolve();
await settle(); await wait(30); await settle();
check("[3c] 받는 사이 입력한 글 저장됨", st.cells["11:1"] === "typed during refresh", st.cells);
check("[3c] 교체된 표에도 그 글", env.d.querySelector('textarea.pj-goal-text[data-row="11"][data-month="1"]').value === "typed during refresh");
check("[3c] 교체된 표에도 그 글", env.d.querySelector('.pj-goal-text[data-row="11"][data-month="1"]').value === "typed during refresh");
check("[3c] 표를 다시 받음(2회)", st.gets === 2, st.gets);
});
await section(async function () { // 병합 — 저장 실패면 병합 요청 안 보냄
const env = makeEnv(PAGE.goals_admin, GOALS_URL);
const st = goalsServer(env, { cellHook: function () { return { status: 503, body: { detail: "x" } }; } });
await boot(env);
const ta = env.d.querySelector('textarea.pj-goal-text[data-row="10"][data-month="1"]');
const ta = env.d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
ta.focus(); type(env, ta, "draft before merge");
const a = env.d.querySelector('td.pj-goal-texttd[data-month="1"]'), b = env.d.querySelector('tr[data-row-id="10"] td.pj-goal-texttd[data-month="2"]');
a.dispatchEvent(new env.w.MouseEvent("mousedown", { bubbles: true, button: 0 }));
@@ -656,6 +664,33 @@ function meetServer(env, st) {
check("[회귀] 참석자 고르기 → 칩 + 저장", !!env.d.querySelector('.pj-meet-chip[data-key="a@test.local"]') && st.head.attendees === "a@test.local", st.head);
});
await section(async function () { // 선택한 글자만 서식·서식 초기화·저장·다시 그리기
const env = makeEnv(PAGE.goals_admin, "http://localhost/project/goals/2026"); const st = goalsServer(env); await boot(env);
const d = env.d, w = env.w, editor = d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
type(env, editor, "앞 선택 뒤"); editor.focus();
const range = d.createRange(); range.setStart(editor.firstChild, 2); range.setEnd(editor.firstChild, 4);
w.getSelection().removeAllRanges(); w.getSelection().addRange(range); fire(env, editor, "mouseup");
const format = function (name, value, event) { const el = d.querySelector('[data-goal-format="' + name + '"]'); el.value = value; fire(env, el, event || "change"); };
format("bold", "700"); format("color", "#ff0000", "input"); format("size", "20");
let runs = w.PJGoalText.readRuns(editor);
check("[서식] 선택한 두 글자에만 색·굵기·크기", runs.length === 3 && runs[0].text === "앞 " && runs[1].text === "선택" && runs[1].bold === true && runs[1].color === "#ff0000" && runs[1].size === 20 && !runs[2].bold, runs);
fire(env, editor, "blur"); await settle();
check("[서식] 텍스트 조각을 기존 셀 API에 저장", st.cells["10:1"].startsWith("pj-rich:v1:") && JSON.parse(st.cells["10:1"].slice(11))[1].size === 20);
const persisted = st.cells["10:1"];
d.querySelector('[data-goal-format="reset"]').click(); fire(env, editor, "blur"); await settle();
check("[서식] 선택 서식 초기화는 글을 유지하고 평문 저장", editor.textContent === "앞 선택 뒤" && st.cells["10:1"] === "앞 선택 뒤");
editor.value = persisted; fire(env, editor, "input"); fire(env, editor, "blur"); await settle();
d.getElementById("pj-goal-area-add").click(); await settle(); await wait(20); await settle();
const fresh = d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
check("[서식] 표 다시 그리기에도 선택 서식 유지", fresh !== editor && w.PJGoalText.readRuns(fresh)[1].size === 20);
fresh.focus();
const plainRange = d.createRange(); plainRange.setStart(fresh.firstChild, 0); plainRange.setEnd(fresh.firstChild, 1);
w.getSelection().removeAllRanges(); w.getSelection().addRange(plainRange); fire(env, fresh, "mouseup");
check("[서식] 새 평문 선택은 도구 값을 기본값으로 표시", d.querySelector('[data-goal-format="bold"]').value === "400" && d.querySelector('[data-goal-format="size"]').value === "14");
plainRange.collapse(true); w.getSelection().removeAllRanges(); w.getSelection().addRange(plainRange); fire(env, fresh, "keyup");
check("[서식] 글자 선택을 해제하면 이전 선택에 적용하지 않음", d.querySelector('[data-goal-format="reset"]').disabled);
});
clearTimeout(WATCHDOG);
const realUnhandled = unhandled.filter(function (m) { return !/Not implemented/.test(m); });
check("처리 안 된 Promise 거부 없음", realUnhandled.length === 0, realUnhandled);
+30 -1
View File
@@ -33,6 +33,9 @@ function makeEnv() {
const dom = new JSDOM(html, { runScripts: "dangerously", pretendToBeVisual: true, url: "http://localhost/project/p/1" });
const w = dom.window, d = w.document;
w.__PJ_TEST__ = true;
w.HTMLDialogElement.prototype.showModal = function () { this.open = true; };
w.HTMLDialogElement.prototype.close = function () { this.open = false; this.dispatchEvent(new w.Event("close")); };
Object.defineProperty(d, "fonts", { configurable: true, value: { load: async function () { return [{}]; } } });
w.HTMLCanvasElement.prototype.getContext = function () { return null; };
w.URL.createObjectURL = function () { return "blob:x"; };
w.URL.revokeObjectURL = function () {};
@@ -103,6 +106,7 @@ async function boot(env) {
// 문제없음, 기존 코드 그대로). 테스트에서는 버튼 보강을 건너뛰고 원래 입력칸으로 시험한다.
env.d.querySelectorAll("select").forEach(function (s) { s.dataset.pjEnhanced = "1"; });
env.d.querySelectorAll("input[type=date]").forEach(function (i) { i.dataset.pjDate = "1"; });
env.w.eval(fs.readFileSync(path.join(ROOT, "app", "static", "project-options.js"), "utf8"));
env.w.eval(JS);
env.d.dispatchEvent(new env.w.Event("DOMContentLoaded"));
await settle();
@@ -421,7 +425,7 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
// 보드 빠른 추가 — 세 필드, 조합 입력·중복 저장·실패 복구·취소.
{
const env = makeEnv(); baseRoutes(env); await boot(env);
const env = makeEnv(); baseRoutes(env); const P = await boot(env);
const d = env.d, w = env.w, pending = deferred();
const posts = function () { return env.calls.filter(function (c) { return c.method === "POST" && /projects\/1\/tasks$/.test(c.url); }); };
env.route("POST", /projects\/1\/tasks$/, function () { return pending.promise; });
@@ -450,6 +454,9 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
d.body.dispatchEvent(new w.Event("pointerdown", { bubbles: true })); await wait(10); await settle();
check("[board] 빈 카드 바깥 클릭은 빈 작업 생성 없이 닫기", !d.querySelector(".pj-tasknew") && posts().length === 1);
d.querySelector('.pj-col[data-stage-id="11"] .pj-col-add').click(); await wait(10);
check("[board] 상단 +는 기존 오른쪽 상세창을 열기", !d.getElementById("pj-modal-task").hidden && !d.querySelector(".pj-tasknew"));
await P.attemptClose(); await wait(400);
d.querySelector('.pj-col[data-stage-id="11"] .pj-col-addtask').click(); await wait(10);
input = d.querySelector(".pj-tasknew-title"); input.value = "실패해도 유지"; input.dispatchEvent(new w.Event("input"));
env.route("POST", /projects\/1\/tasks$/, function () { return { status: 500, body: { detail: "잠시 오류" } }; });
d.body.dispatchEvent(new w.Event("pointerdown", { bubbles: true })); await wait(10); await settle();
@@ -496,6 +503,28 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
check("[board] 기존 다른 부모 카드 이동 유지", env.calls.some(function (c) { return /tasks\/901\/move-parent$/.test(c.url) && c.body.parent_task_id === 102; }) && rows().join(",") === "902,903");
}
{
const env = makeEnv(); baseRoutes(env); await boot(env); const d = env.d, w = env.w;
const button = d.getElementById("pj-options-btn"), dialog = d.getElementById("pj-options-dialog"), select = d.getElementById("pj-options-font");
button.click();
check("[옵션] 도움말 옆 옵션은 기본 폰트로 대화창 열기", dialog.open && select.value === "system" && select.options.length === 5);
select.value = "pretendard"; select.dispatchEvent(new w.Event("change")); d.getElementById("pj-options-cancel").click();
check("[옵션] 취소는 선택한 폰트를 적용하지 않음", !dialog.open && !w.localStorage.getItem("pj_font"));
button.click(); select.value = "nanum-square-neo"; d.getElementById("pj-options-save").click(); await settle();
check("[옵션] 저장은 폰트 적용·기억 후 대화창 닫기", !dialog.open && w.localStorage.getItem("pj_font") === "nanum-square-neo" && d.documentElement.dataset.pjFont === "nanum-square-neo");
button.click(); check("[옵션] 다시 열면 저장한 선택 유지", select.value === "nanum-square-neo");
const loading = deferred(); d.fonts.load = function () { return loading.promise; };
select.value = "pretendard"; d.getElementById("pj-options-save").click(); await settle();
const cancel = new w.Event("cancel", { cancelable: true }); dialog.dispatchEvent(cancel);
check("[옵션] 저장 중 취소·Esc로 지연 적용이 발생하지 않음", d.getElementById("pj-options-cancel").disabled && cancel.defaultPrevented && dialog.open);
loading.resolve([{}]); await settle();
check("[옵션] 폰트 로딩 후 저장 완료", !dialog.open && w.localStorage.getItem("pj_font") === "pretendard");
button.click();
d.fonts.load = async function () { throw new Error("font failed"); };
select.value = "nanum-square-round"; d.getElementById("pj-options-save").click(); await settle();
check("[옵션] 폰트 로딩 실패는 이전 설정 유지·재시도 가능", dialog.open && !d.getElementById("pj-options-error").hidden && !select.disabled && w.localStorage.getItem("pj_font") === "pretendard");
}
clearTimeout(WATCHDOG);
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
process.exit(fails.length ? 1 : 0);
+1 -1
View File
@@ -21,7 +21,7 @@ OUT_DIR = os.path.join(ROOT, "tests", "js", ".out")
from app.modules.project import store # noqa: E402
from app.modules.project.router import _goal_area_layout, _goal_label_spans # noqa: E402
BASE_STUB = ("{% block head_extra %}{% endblock %}<body>{% block topbar_actions %}{% endblock %}"
BASE_STUB = ("{% block head_extra %}{% endblock %}<body>{% block topbar_after_logout %}{% endblock %}{% block topbar_actions %}{% endblock %}"
"<main class='erp-page'>{% block content %}{% endblock %}</main></body>")
ME = "me@test.local"
+1 -1
View File
@@ -13,7 +13,7 @@ import jinja2
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
OUT_DIR = os.path.join(ROOT, "tests", "js", ".out")
BASE_STUB = ("{% block head_extra %}{% endblock %}<body>{% block topbar_actions %}{% endblock %}"
BASE_STUB = ("{% block head_extra %}{% endblock %}<body>{% block topbar_after_logout %}{% endblock %}{% block topbar_actions %}{% endblock %}"
"<main class='erp-page'>{% block content %}{% endblock %}</main></body>")
ME = "me@test.local"
+37
View File
@@ -0,0 +1,37 @@
import json
import unittest
from app.modules.project import store
def rich(runs):
return store.GOAL_RICH_PREFIX + json.dumps(runs, ensure_ascii=False)
class GoalRichTextTests(unittest.TestCase):
def test_selected_styles_are_safe_and_legacy_text_stays_literal(self):
body = rich([{"text": "<img src=x onerror=alert(1)>", "bold": True,
"color": "#FF0000", "size": 20, "onclick": "alert(1)"},
{"text": " untouched", "color": "url(javascript:x)", "size": 99}])
stored = store.validate_goal_text(body)
html = store.goal_text_html(stored)
assert '&lt;img' in html and '<img' not in html
assert 'font-weight:700' in html and 'color:#ff0000' in html and 'font-size:20px' in html
assert 'javascript' not in html and 'onclick' not in stored and '99px' not in html
assert store.goal_text_html('<b>legacy</b>') == '&lt;b&gt;legacy&lt;/b&gt;'
def test_rich_merge_preserves_styles_and_plain_meeting_plan(self):
value = store.merge_goal_texts(['first', rich([{"text": "second", "bold": True, "size": 18}])])
assert store.goal_text_plain(value) == 'first\nsecond'
assert 'font-size:18px' in store.goal_text_html(value)
assert store.merge_goal_texts(['a', 'b']) == 'a\nb'
assert store.validate_goal_text(rich([{"text": " "}])) == ''
def test_rich_payload_limits_and_malformed_data(self):
with self.assertRaises(ValueError):
store.validate_goal_text(rich([{"text": "x" * (store.GOAL_TEXT_MAX + 1)}]))
with self.assertRaises(ValueError):
store.validate_goal_text(store.GOAL_RICH_PREFIX + '{"unexpected":1}')
with self.assertRaises(ValueError):
store.validate_goal_text(store.GOAL_RICH_PREFIX + '[broken')