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
+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열(연간 칸) 하나 우클릭 — 줄 추가·삭제도