feat(project): add Excel font controls and reflow

This commit is contained in:
2026-10-03 05:47:57 +09:00
parent 494d84f7c2
commit dc2008c5b3
13 changed files with 146 additions and 42 deletions
+7 -2
View File
@@ -504,8 +504,9 @@ def goal_text_runs(body: Any, *, strict: bool = False) -> list[dict[str, Any]]:
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"]
for key in ("bold", "italic", "underline"):
if isinstance(item.get(key), bool):
run[key] = item[key]
if re.fullmatch(r"#[0-9a-fA-F]{6}", str(item.get("color", ""))):
run["color"] = item["color"].lower()
size = item.get("size")
@@ -533,6 +534,10 @@ def goal_text_html(body: Any) -> str:
style = []
if "bold" in run:
style.append("font-weight:" + ("700" if run["bold"] else "400"))
if "italic" in run:
style.append("font-style:" + ("italic" if run["italic"] else "normal"))
if "underline" in run:
style.append("text-decoration:" + ("underline" if run["underline"] else "none"))
if "color" in run:
style.append("color:" + run["color"])
if "size" in run:
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -39,16 +39,24 @@
{% if is_admin and goals_enabled and board %}
<div class="pj-goal-format" id="pj-goal-format" role="toolbar" aria-label="선택한 글자 서식" hidden>
<div class="pj-goal-color-picker"><span>색상</span>
<button type="button" class="pj-goal-color-toggle" data-goal-format="color" aria-label="글자 색상" aria-expanded="false" aria-controls="pj-goal-color-grid" disabled><span class="pj-goal-color-preview"></span></button>
<div class="pj-goal-format-group pj-goal-color-picker">
<button type="button" class="pj-goal-format-btn pj-goal-color-toggle" data-goal-format="color" aria-label="글자 색상" title="글자 색상" aria-expanded="false" aria-controls="pj-goal-color-grid" disabled><span class="pj-goal-color-letter" aria-hidden="true">가<span class="pj-goal-color-preview"></span></span><svg class="pj-goal-format-chevron" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.3" aria-hidden="true"><path d="m2 4 3 3 3-3"/></svg></button>
<div class="pj-goal-color-grid" id="pj-goal-color-grid" role="group" aria-label="글자 색상 선택" hidden>
{% for color in ('#000000', '#4B5563', '#9CA3AF', '#DC2626', '#EA580C', '#CA8A04', '#16A34A', '#0891B2', '#2563EB', '#7C3AED', '#DB2777', '#FFFFFF') %}
<button type="button" class="pj-goal-text-swatch" data-goal-color="{{ color }}" style="--swatch: {{ color }}" title="{{ color }}" aria-label="{{ color }}" aria-pressed="false" disabled></button>
{% endfor %}
</div>
</div>
<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>
<div class="pj-goal-format-group" role="group" aria-label="글자 크기">
<button type="button" class="pj-goal-format-btn" data-goal-format="size-up" aria-label="글자 크기 2px 키우기" title="글자 크기 2px 키우기" disabled><span class="pj-goal-font-letter" aria-hidden="true">가</span><svg class="pj-goal-font-arrow" viewBox="0 0 10 14" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><path d="M5 9V2M2 5l3-3 3 3"/></svg></button>
<button type="button" class="pj-goal-format-btn" data-goal-format="size-down" aria-label="글자 크기 2px 줄이기" title="글자 크기 2px 줄이기" disabled><span class="pj-goal-font-letter" aria-hidden="true">가</span><svg class="pj-goal-font-arrow" viewBox="0 0 10 14" fill="none" stroke="currentColor" stroke-width="1.2" aria-hidden="true"><path d="M5 2v7M2 6l3 3 3-3"/></svg></button>
<output class="pj-goal-size-value" data-goal-format="size" aria-label="선택한 글자 크기">14px</output>
</div>
<div class="pj-goal-format-group" role="group" aria-label="글자 모양">
{% for key, label in (('bold', '굵게'), ('italic', '기울임'), ('underline', '밑줄')) %}
<button type="button" class="pj-goal-format-btn" data-goal-format="{{ key }}" aria-label="{{ label }}" title="{{ label }}" aria-pressed="false" disabled><span class="pj-goal-font-letter" aria-hidden="true">가</span></button>
{% endfor %}
</div>
<button type="button" class="pj-btn" data-goal-format="reset" disabled>서식 초기화</button>
</div>
{% endif %}
@@ -197,7 +205,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">칸을 고치면 바로 저장됩니다. 글자를 드래그해 선택하면 선택 영역 위의 메뉴에서 12색 견본·굵기·크기를 고르거나 서식을 초기화할 수 있습니다. 모든 행의 셀 오른쪽 경계를 끌어 열 너비를 조절합니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하거나 칸의 ⋮ 버튼(키보드 Tab·Enter, 터치)을 누르면 색·순서·줄 추가·삭제 메뉴가 나옵니다.
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 글자를 드래그해 선택하면 선택 영역 위에서 12색 견본·크기 2px 증감·굵게·기울임·밑줄·서식 초기화를 사용할 수 있습니다. 모든 행의 셀 오른쪽 경계를 끌어 열 너비를 조절합니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하거나 칸의 ⋮ 버튼(키보드 Tab·Enter, 터치)을 누르면 색·순서·줄 추가·삭제 메뉴가 나옵니다.
{%- if board.halves %} 칸을 마우스로 끌어 여러 칸을 고른 뒤 우클릭 → 셀 병합, 병합된 칸은 우클릭 → 병합 해제(글은 왼쪽 위 칸에 남음).{% endif %}
월 이름을 누르면 그 달 주간 회의록이 열립니다.</span>
</div>
@@ -212,6 +220,6 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project-goal-text.js?v=20261003a" defer></script>
<script src="/static/project-goal-text.js?v=20261003b" defer></script>
<script src="/static/project.js?v=20261003a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/project-help.css?v=20261002d" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -88,14 +88,15 @@
<li><b>수신함</b> — 나를 태그한 작업과 알림. 숫자 배지는 아직 확인하지 않은 @태그 수입니다. (<a href="#inbox">17장</a>)</li>
<li><b>내 작업</b> — 내가 담당자인 작업 모음. 숫자 배지는 아직 끝나지 않은 작업 수입니다. (<a href="#mytasks">15장</a>)</li>
<li><b>휴지통</b> — 지운 작업을 3개월 보관합니다. 관리자에게만 보입니다. (<a href="#trash">19장</a>)</li>
<li>왼쪽 메뉴의 오른쪽 경계를 끌면 너비를 최소 170px까지 줄일 수 있습니다. 경계에 키보드 포커스를 놓고 좌우 방향키로도 조절할 수 있으며 너비는 내 브라우저에 기억됩니다.</li>
<li>왼쪽 메뉴의 오른쪽 경계를 끌면 너비를 최소 170px까지 줄일 수 있습니다. 경계에 키보드 포커스를 놓고 좌우 방향키로도 조절할 수 있으며 너비는 내 브라우저에 기억됩니다. 전체 멤버는 메뉴 너비에 맞춰 4열 또는 3열로 자동 배치됩니다.</li>
<li><b>목표</b> — 누르면 바로 아래에 연도가 펼쳐집니다. 연도를 누르면 오른쪽에 그해 전체 목표가 한 표로 나옵니다 —
맨 위에 <b>매출</b>(목표·실적·달성률)과 <b>로아스</b>(목표·실적, 단위 %)를 달마다, 그 아래에 <b>업무 영역</b>(상품·마케팅·컨텐츠·유통 등)별로
연간·분기·월별 계획을 적습니다. 3·6·9·12월 오른쪽에 <b>1~4분기</b> 칸이 있고, 매출의 <b>연간·분기</b> 칸은 월 합계,
<b>달성</b>은 실적÷목표(100% 이상 초록)로 저절로 계산됩니다. 분기 칸 머리의 <b>‹</b> 버튼을 누르면 그 분기의 월 칸 3개가
접히고, 다시 누르면 펼쳐집니다(접힌 상태는 내 브라우저에 기억). 월 이름을 누르면 그 달 <b>주간 회의록</b>이 열립니다.
<b>입력은 관리자만</b> 할 수 있고(칸을 고치면 바로 저장), 다른 직원은 보기만 합니다. 관리자는 <b>+ 연도 추가</b>로 새해 목표를
만듭니다(이전 연도의 업무 영역 구성을 그대로 가져옴). 글 칸에서 <b>글자를 드래그해 선택</b>하면 선택한 글자 위에 나타나는 서식 도구로 <b>색상·굵기·크기</b>를 바꿀 수 있으며 선택한 글자에만 적용됩니다.
만듭니다(이전 연도의 업무 영역 구성을 그대로 가져옴). 글 칸에서 <b>글자를 드래그해 선택</b>하면 선택한 글자 위에 나타나는 엑셀 형태 서식 도구로 <b>색상·크기·굵게·기울임·밑줄</b>을 바꿀 수 있으며 선택한 글자에만 적용됩니다.
위/아래 화살표가 붙은 글자 버튼은 크기를 <b>2px씩</b> 키우거나 줄입니다(10~32px). 굵게·기울임·밑줄 버튼은 다시 누르면 해당 서식을 해제합니다.
<span class="pjh-ui">서식 초기화</span>는 선택한 글자를 기본 서식으로 되돌리며 내용은 유지합니다. 서식도 자동으로 저장됩니다. 색상은 12색의 네모 견본에서 고릅니다.
<b>모든 행의 셀 오른쪽 경계</b>를 끌어 열 너비를 조절하고, 더블클릭하면 기본 너비로 돌아갑니다(병합 칸은 오른쪽 끝 열).
영역·줄 이름은 <b>눌러서 그 자리에서 고치고</b>(Enter 저장, Esc 취소),
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261003a" />
<link rel="stylesheet" href="/static/project.css?v=20261003b" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
+27 -6
View File
@@ -2,12 +2,19 @@
(function () {
"use strict";
const PREFIX = "pj-rich:v1:";
const STYLE_KEYS = ["bold", "italic", "underline", "color", "size"];
const TOGGLES = ["bold", "italic", "underline"];
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;
if (node.tagName === "I" || node.tagName === "EM") s.italic = true;
if (css.fontStyle) s.italic = css.fontStyle === "italic" || css.fontStyle === "oblique";
if (node.tagName === "U") s.underline = true;
const decoration = css.textDecorationLine || css.textDecoration;
if (decoration) s.underline = decoration.includes("underline");
const size = parseInt(css.fontSize, 10);
if (size >= 10 && size <= 32) s.size = size;
if (css.color) {
@@ -38,7 +45,7 @@
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;
if (prev && STYLE_KEYS.every(function (key) { return prev[key] === run[key]; })) prev.text += run.text;
else out.push(Object.assign({}, run));
});
return out;
@@ -60,6 +67,8 @@
const span = document.createElement("span");
span.textContent = r.text;
if (typeof r.bold === "boolean") span.style.fontWeight = r.bold ? "700" : "400";
if (typeof r.italic === "boolean") span.style.fontStyle = r.italic ? "italic" : "normal";
if (typeof r.underline === "boolean") span.style.textDecoration = r.underline ? "underline" : "none";
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));
@@ -159,9 +168,16 @@
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";
TOGGLES.forEach(function (key) {
const all = chosen.every(function (r) { return r[key] === true; });
const some = chosen.some(function (r) { return r[key] === true; });
toolbar.querySelector("[data-goal-format='" + key + "']").setAttribute("aria-pressed", all ? "true" : some ? "mixed" : "false");
});
showColor(uniform("color", "#000000"));
toolbar.querySelector("[data-goal-format='size']").value = String(uniform("size", 14));
const sizes = chosen.map(function (r) { return r.size || 14; });
toolbar.querySelector("[data-goal-format='size']").textContent = sizes.every(function (n) { return n === sizes[0]; }) ? sizes[0] + "px" : "혼합";
toolbar.querySelector("[data-goal-format='size-up']").disabled = sizes.every(function (n) { return n >= 32; });
toolbar.querySelector("[data-goal-format='size-down']").disabled = sizes.every(function (n) { return n <= 10; });
toolbar.hidden = false;
place();
}
@@ -179,7 +195,8 @@
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; }
if (key === "reset") STYLE_KEYS.forEach(function (style) { delete middle[style]; });
else if (key === "size-delta") middle.size = Math.max(10, Math.min(32, (middle.size || 14) + value));
else middle[key] = value;
out.push(middle);
if (b < end) out.push(Object.assign({}, run, { text: run.text.slice(b - pos) }));
@@ -199,8 +216,12 @@
if (!btn) return;
apply("color", btn.dataset.goalColor.toLowerCase()); closeColors();
});
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)); });
TOGGLES.forEach(function (key) {
const btn = toolbar.querySelector("[data-goal-format='" + key + "']");
btn.addEventListener("click", function () { apply(key, btn.getAttribute("aria-pressed") !== "true"); });
});
toolbar.querySelector("[data-goal-format='size-up']").addEventListener("click", function () { apply("size-delta", 2); });
toolbar.querySelector("[data-goal-format='size-down']").addEventListener("click", function () { apply("size-delta", -2); });
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;
+28 -10
View File
@@ -113,7 +113,7 @@
.pj-side-resizer { position: absolute; top: 0; bottom: 0; left: var(--pj-side-w, 250px); width: 8px; padding: 0; border: 0; background: transparent; cursor: col-resize; z-index: 12; }
.pj-side-resizer:hover, .pj-side-resizer:focus-visible, .pj-side-resizer.is-dragging { background: var(--pj-accent-tint); outline: none; }
html.pj-side-resizing, html.pj-side-resizing * { cursor: col-resize !important; user-select: none !important; }
.pj-side { min-width: 0; min-height: 0; height: 100%; overflow-y: auto; padding-right: 14px; }
.pj-side { min-width: 0; min-height: 0; height: 100%; overflow-y: auto; padding-right: 14px; container: pj-side / inline-size; }
.pj-main { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; }
/* ── 자체 스크롤 패널(내 업무/좌측 목록/홈 프로젝트 목록/보드)의 스크롤 막대 ──
@@ -1007,13 +1007,16 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
.pj-member-pick-avatar img.pj-member-pick-icon { width: 36px; height: 36px; }
.pj-member-pick-stacked .pj-member-pick-name { font-size: 12.5px; }
/* ── 좌측 사이드바 "전체 멤버" — 4열 그리드, 아이콘 아래 이름(새 프로젝트
/* ── 좌측 사이드바 "전체 멤버" — 메뉴의 실제 내부 폭에 따라 4열↔3열, 아이콘 아래 이름(새 프로젝트
모달의 pj-member-pick-stacked 와 같은 아이콘 크기 재사용). ── */
.pj-allmembers-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 4px; }
.pj-allmembers-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 4px; }
@container pj-side (max-width: 207px) {
.pj-allmembers-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pj-allmember-item {
display: flex; flex-direction: column; align-items: center; gap: 4px;
padding: 6px 2px; border: none; background: none; border-radius: 8px; cursor: pointer;
font: inherit; width: 100%;
font: inherit; width: 100%; min-width: 0; box-sizing: border-box;
}
.pj-allmember-item:hover { background: #f5f6f8; }
.pj-allmember-item .pj-member-pick-icon.material-symbols-outlined { font-size: 40px; }
@@ -2719,13 +2722,28 @@ html[data-pj-font="nanum-square-round"] { --pj-font: "NanumSquareRound", var(--p
.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 { position: fixed; z-index: 1200; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 8px 10px; max-width: calc(100vw - 16px); box-sizing: border-box; border: 1px solid var(--pj-border); border-radius: 8px; box-shadow: 0 4px 16px #0002; background: #fff; color: var(--pj-ink); font-family: var(--pj-font); font-size: 12px; }
.pj-goal-format { position: fixed; z-index: 1200; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 8px; max-width: calc(100vw - 16px); box-sizing: border-box; border: 1px solid var(--pj-border); border-radius: 8px; box-shadow: 0 4px 16px #0002; background: #fff; color: var(--pj-ink); font-family: var(--pj-font); font-size: 12px; }
.pj-goal-format[hidden], .pj-goal-color-grid[hidden] { display: none; }
.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-color-picker { position: relative; display: flex; align-items: center; gap: 6px; }
.pj-goal-color-toggle { width: 30px; height: 28px; padding: 4px; border: 1px solid #d8dce2; border-radius: 4px; background: #fff; cursor: pointer; }
.pj-goal-color-preview { display: block; width: 100%; height: 100%; background: #000; box-shadow: inset 0 0 0 1px #0002; }
.pj-goal-format-group { display: inline-flex; align-items: center; gap: 2px; }
.pj-goal-format-group + .pj-goal-format-group { border-left: 1px solid var(--pj-border); padding-left: 6px; }
.pj-goal-format .pj-goal-format-btn, .pj-goal-format [data-goal-format="reset"] { display: inline-flex; align-items: center; justify-content: center; height: 32px; box-sizing: border-box; border: 1px solid transparent; border-radius: 4px; padding: 0 8px; background: #fff; color: inherit; font: inherit; line-height: 1; cursor: pointer; }
.pj-goal-format .pj-goal-format-btn { min-width: 32px; }
.pj-goal-format .pj-goal-format-btn:hover, .pj-goal-format [data-goal-format="reset"]:hover { background: #f3f4f6; }
.pj-goal-format .pj-goal-format-btn[aria-pressed="true"] { border-color: #b5b9c0; background: #e8eaed; }
.pj-goal-format .pj-goal-format-btn[aria-pressed="mixed"] { background: #f3f4f6; box-shadow: inset 0 -2px #9ca3af; }
.pj-goal-format .pj-goal-format-btn:focus-visible { outline: 2px solid var(--pj-accent); outline-offset: 1px; }
.pj-goal-format [data-goal-format="reset"] { border-color: #d8dce2; margin-left: 4px; }
.pj-goal-color-picker { position: relative; display: flex; align-items: center; }
.pj-goal-color-toggle { gap: 5px; }
.pj-goal-color-letter { display: flex; flex-direction: column; align-items: stretch; font-size: 17px; line-height: 18px; }
.pj-goal-color-preview { display: block; width: 18px; height: 3px; background: #000; box-shadow: inset 0 0 0 1px #0002; }
.pj-goal-format-chevron { width: 8px; height: 8px; }
.pj-goal-font-letter { font-size: 16px; }
.pj-goal-font-arrow { width: 10px; height: 14px; align-self: flex-start; margin-top: 4px; color: #2563eb; }
.pj-goal-size-value { min-width: 36px; text-align: center; color: var(--pj-ink-soft); font-variant-numeric: tabular-nums; }
.pj-goal-format [data-goal-format="bold"] .pj-goal-font-letter { font-weight: 700; }
.pj-goal-format [data-goal-format="italic"] .pj-goal-font-letter { font-style: italic; }
.pj-goal-format [data-goal-format="underline"] .pj-goal-font-letter { text-decoration: underline; text-underline-offset: 3px; }
.pj-goal-color-grid { position: absolute; bottom: calc(100% + 8px); left: 0; display: grid; grid-template-columns: repeat(6, 26px); gap: 6px; padding: 8px; background: #fff; border: 1px solid var(--pj-border); border-radius: 6px; box-shadow: 0 4px 12px #0002; }
.pj-goal-color-grid.is-below { bottom: auto; top: calc(100% + 8px); }
.pj-goal-text-swatch { width: 26px; height: 26px; border: 1px solid #0003; border-radius: 3px; background: var(--swatch); cursor: pointer; padding: 0; }
+7 -3
View File
@@ -54,6 +54,8 @@
**화면 조정(2026-10-03)** — 본문 좌우 여백 8px. 공용 왼쪽 메뉴 오른쪽 경계를 드래그해
170~500px로 조절(방향키도 지원, 더블클릭 기본값), `localStorage.pj_side_w`에 기억한다.
수신함·내 작업 배지는 메뉴 이름 바로 옆에 표시. 댓글·답글 입력칸은 70px 고정 높이, 긴 글은 내부 스크롤.
전체 멤버는 메뉴 내부 폭 207px 이하에서는 3열, 그보다 넓으면 4열로 자동 재배치한다(container query).
각 멤버 칸은 최소 너비를 강제하지 않고 스크롤바용 여백 안에 맞추므로 오른쪽 멤버가 가려지지 않는다.
보드 그룹 머리의 왼쪽 화살표+세로선 아이콘은 그룹 축소, 축소 후 반대 방향 아이콘으로 펼치기.
축소 시 카드·추가 버튼을 숨기고 섹션 제목·작업 수를 세로로 표시하며
`localStorage['pj_board_fold:'+projectId]`에 섹션 id(전체 프로젝트 보기에서는 이름)별로 기억한다.
@@ -658,9 +660,11 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
- 묶음 첫 줄 삭제 → 바로 아래 이어 붙은 줄이 첫 줄이 되고 이름이 비어 있으면 넘겨받음. 묶인 줄(첫 줄·이어 붙은 줄)과 바꾸는 ↑↓ 이동은 400
(나눈 뒤 이동), 묶음 첫 줄 도구 막대엔 ↑↓ 없음. 새 연도 만들기는 묶음도 복사한다.
- **선택한 글자 서식**(관리자, 2026-10-02) — 목표 업무 영역 글 칸은 `.pj-goal-text[contenteditable]`.
같은 칸의 글자를 드래그해 선택하면 선택 영역 위 도구로 지정된 12색 견본·굵기(400/700)·크기(10~32px)를 선택한다.
서식 초기화는 선택 범위의 세 서식만 제거하며 글은 유지한다. 기존 `createFieldSaver`의 자동 저장·실패 재시도·임시 복구를 재사용한다.
`goal_cells.body` TEXT에 `pj-rich:v1:` + JSON 텍스트 조각 배열 `{text,bold?,color?,size?}`를 저장한다(추가 마이그레이션 없음).
같은 칸의 글자를 드래그해 선택하면 선택 영역 위에 엑셀 형태 도구가 나타난다. 밑에 현재 색상 선을 둔 `가`+드롭다운은 기존 12색 견본,
`가`+위/아래 화살표는 크기 2px 증감(10~32px, 혼합 크기는 조각마다 증감), 굵게·기울임·밑줄은 적용 상태가 보이는 토글 버튼.
초기화 버튼을 포함한 모든 버튼은 32px 높이. 서식 초기화는 선택 범위의 모든 서식만 제거하며 글은 유지한다.
기존 `createFieldSaver`의 자동 저장·실패 재시도·임시 복구를 재사용한다.
`goal_cells.body` TEXT에 `pj-rich:v1:` + JSON 텍스트 조각 배열 `{text,bold?,italic?,underline?,color?,size?}`를 저장한다(추가 마이그레이션 없음).
평문은 기존 형식 그대로, `store.validate_goal_text`가 허용 서식과 보이는 글자 길이를 검사하고 `goal_text_html`이 글을 escape한 안전한 span만 만든다.
셀 병합은 각 조각 서식을 보존하고, 회의록 월간 계획 추출은 `goal_text_plain`으로 글만 읽는다.
- **칸 아무 곳이나 눌러 입력**(엑셀처럼) — 글 입력칸은 글 높이만큼이라, 옆 칸 글이 길거나 세로 병합으로 칸이 길면 아래쪽을 눌러도
+36 -6
View File
@@ -686,13 +686,19 @@ function meetServer(env, st) {
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");
check("[서식] 글자 선택하면 body 팝업 표시", !toolbar.hidden && toolbar.parentElement === d.body);
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");
const format = function (name) { d.querySelector('[data-goal-format="' + name + '"]').click(); };
format("bold"); format("italic"); format("underline");
d.querySelector('[data-goal-format="color"]').click();
check("[서식] 색상 버튼으로 견본 펼침", !d.getElementById("pj-goal-color-grid").hidden);
d.querySelector('[data-goal-color="#DC2626"]').click(); format("size", "20");
d.querySelector('[data-goal-color="#DC2626"]').click(); format("size-up"); format("size-up"); format("size-up");
let runs = w.PJGoalText.readRuns(editor);
check("[서식] 선택한 두 글자에만 색·굵기·크기", runs.length === 3 && runs[0].text === "앞 " && runs[1].text === "선택" && runs[1].bold === true && runs[1].color === "#dc2626" && runs[1].size === 20 && !runs[2].bold, runs);
check("[서식] 선택한 두 글자에만 색·굵게·기울임·밑줄·크기", runs.length === 3 && runs[0].text === "앞 " && runs[1].text === "선택" && runs[1].bold === true && runs[1].italic === true && runs[1].underline === true && runs[1].color === "#dc2626" && runs[1].size === 20 && !runs[2].bold, runs);
check("[서식] 토글 버튼은 적용 상태 표시", ["bold", "italic", "underline"].every(function (k) { return d.querySelector('[data-goal-format="' + k + '"]').getAttribute("aria-pressed") === "true"; }));
format("size-down");
check("[서식] 크기 줄이기는 2px", w.PJGoalText.readRuns(editor)[1].size === 18 && d.querySelector('[data-goal-format="size"]').textContent === "18px");
format("size-up"); format("italic"); format("underline");
check("[서식] 다시 누르면 기울임·밑줄 해제", w.PJGoalText.readRuns(editor)[1].italic === false && w.PJGoalText.readRuns(editor)[1].underline === false);
format("italic"); format("underline");
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"];
@@ -701,15 +707,39 @@ function meetServer(env, st) {
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);
check("[서식] 표 다시 그리기에도 선택 서식 유지", fresh !== editor && w.PJGoalText.readRuns(fresh)[1].size === 20 && w.PJGoalText.readRuns(fresh)[1].italic === true && w.PJGoalText.readRuns(fresh)[1].underline === true);
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");
check("[서식] 새 평문 선택은 도구 값을 기본값으로 표시", d.querySelector('[data-goal-format="bold"]').getAttribute("aria-pressed") === "false" && d.querySelector('[data-goal-format="size"]').textContent === "14px");
plainRange.collapse(true); w.getSelection().removeAllRanges(); w.getSelection().addRange(plainRange); fire(env, fresh, "keyup");
check("[서식] 글자 선택을 해제하면 숨김·이전 선택 적용 차단", toolbar.hidden && d.querySelector('[data-goal-format="reset"]').disabled);
});
await section(async function () { // 혼합 서식·각 조각 크기 변경·상한/하한
const env = makeEnv(PAGE.goals_admin, GOALS_URL); goalsServer(env); await boot(env);
const d = env.d, w = env.w, editor = d.querySelector('.pj-goal-text[data-row="10"][data-month="1"]');
editor.value = 'pj-rich:v1:' + JSON.stringify([{text:"작은", size:10, bold:true, italic:true}, {text:"큰", size:30, underline:true}]);
editor.focus(); const r = d.createRange(); r.selectNodeContents(editor);
w.getSelection().removeAllRanges(); w.getSelection().addRange(r); fire(env, editor, "mouseup");
const button = function (key) { return d.querySelector('[data-goal-format="' + key + '"]'); };
check("[서식 혼합] 크기는 혼합·토글은 혼합 상태", button("size").textContent === "혼합" && button("bold").getAttribute("aria-pressed") === "mixed");
button("size-up").click(); let runs = w.PJGoalText.readRuns(editor);
check("[서식 혼합] 선택 조각마다 2px 증가", runs[0].size === 12 && runs[1].size === 32);
button("size-up").click(); runs = w.PJGoalText.readRuns(editor);
check("[서식 혼합] 32px 상한 보존", runs[0].size === 14 && runs[1].size === 32);
button("bold").click(); runs = w.PJGoalText.readRuns(editor);
check("[서식 혼합] 혼합에서 클릭하면 전체 굵게·다른 서식 유지", runs.every(function (run) { return run.bold === true; }) && runs[0].italic && runs[1].underline);
button("bold").click();
check("[서식 혼합] 다시 클릭하면 전체 굵게 해제", w.PJGoalText.readRuns(editor).every(function (run) { return run.bold === false; }));
for (let i = 0; i < 12; i++) button("size-down").click();
check("[서식 혼합] 10px 하한·감소 비활성", w.PJGoalText.readRuns(editor).every(function (run) { return run.size === 10; }) && button("size-down").disabled);
for (let i = 0; i < 12; i++) button("size-up").click();
check("[서식 혼합] 32px 상한·증가 비활성", w.PJGoalText.readRuns(editor).every(function (run) { return run.size === 32; }) && button("size-up").disabled);
button("reset").click();
check("[서식 혼합] 초기화는 모든 서식 제거·내용 보존", editor.value === "작은큰");
});
clearTimeout(WATCHDOG);
const realUnhandled = unhandled.filter(function (m) { return !/Not implemented/.test(m); });
check("처리 안 된 Promise 거부 없음", realUnhandled.length === 0, realUnhandled);
+17
View File
@@ -27,6 +27,23 @@ class GoalRichTextTests(unittest.TestCase):
assert store.merge_goal_texts(['a', 'b']) == 'a\nb'
assert store.validate_goal_text(rich([{"text": " "}])) == ''
def test_italic_and_underline_survive_save_render_and_merge(self):
body = rich([{"text": "<선택>", "italic": True, "underline": True, "size": 16},
{"text": "해제", "italic": False, "underline": False},
{"text": "invalid", "italic": "url(javascript:x)", "underline": 1}])
stored = store.validate_goal_text(body)
runs = store.goal_text_runs(stored)
assert runs[0]["italic"] is True and runs[0]["underline"] is True
assert runs[1]["italic"] is False and runs[1]["underline"] is False
assert runs[2] == {"text": "invalid"}
html = store.goal_text_html(stored)
assert '&lt;선택&gt;' in html and 'font-style:italic' in html and 'text-decoration:underline' in html
assert 'font-style:normal' in html and 'text-decoration:none' in html
assert 'javascript' not in stored
merged = store.merge_goal_texts([stored, 'plain'])
assert store.goal_text_runs(merged)[0]["underline"] is True
assert store.goal_text_plain(merged) == '<선택>해제invalid\nplain'
def test_rich_payload_limits_and_malformed_data(self):
with self.assertRaises(ValueError):