feat(project): remove drag-to-move for annual goal cells
Goal text cells no longer get move borders or drag handling; clicking a cell still highlights it. The weekly meeting table keeps its move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -267,5 +267,5 @@
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project-meeting-cells.js?v=20261007a" defer></script>
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -190,7 +190,7 @@
|
||||
<div class="pj-goal-foot">
|
||||
<button type="button" class="pj-btn" id="pj-goal-area-add">+ 업무 영역 추가</button>
|
||||
<span class="pj-goal-note">칸을 고치면 바로 저장됩니다. 글자를 드래그해 선택하면 선택한 셀 상단에서 12색 견본·크기 2px 증감·굵게·기울임·밑줄·서식 초기화를 사용할 수 있습니다. 모든 행의 셀 오른쪽 경계를 끌어 열 너비를 조절하고, 더블클릭하면 그 열의 가장 긴 문단에 맞춥니다. 숫자 칸을 비우면 지워집니다. 구역·항목 칸을 우클릭하거나 칸의 ⋮ 버튼(키보드 Tab·Enter, 터치)을 누르면 색·순서·줄 추가·삭제 메뉴가 나옵니다.
|
||||
셀 우클릭 → 현재 열·전체 열 너비 자동 맞춤(접힌 열 포함). 글 칸 하나를 클릭한 뒤 위·아래·왼쪽 테두리를 끌면 내용과 서식이 함께 이동합니다(대상에 글이 있으면 덮어쓰기 확인, Esc로 취소).
|
||||
셀 우클릭 → 현재 열·전체 열 너비 자동 맞춤(접힌 열 포함).
|
||||
{%- if board.halves %} 칸을 마우스로 끌어 여러 칸을 고른 뒤 우클릭 → 셀 병합, 병합된 칸은 우클릭 → 병합 해제(글은 왼쪽 위 칸에 남음).{% endif %}
|
||||
월 이름을 누르면 그 달 주간 회의록이 열립니다.</span>
|
||||
</div>
|
||||
@@ -207,5 +207,5 @@
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project-goal-text.js?v=20261003d" defer></script>
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -552,16 +552,15 @@
|
||||
<li><b>월 이름</b>을 누르면 그 달의 <a href="#meetings">주간 회의록</a>으로 이동합니다.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="goals-merge">셀 병합·병합 해제·내용 이동</h3>
|
||||
<h3 id="goals-merge">셀 병합·병합 해제</h3>
|
||||
<ol class="pjh-steps">
|
||||
<li>관리자는 업무 영역의 글 칸을 마우스로 끌어 여러 칸을 선택한 뒤 우클릭 → <span class="pjh-ui">셀 병합</span>을 누릅니다.</li>
|
||||
<li>가로 병합은 <b>같은 분기의 월 칸끼리</b> 가능합니다. 연간·분기 칸은 세로로만 병합합니다. 선택한 칸들의 글은 순서대로 첫 칸에 모입니다.</li>
|
||||
<li>병합된 칸을 우클릭 → <span class="pjh-ui">병합 해제</span>하면 다시 나뉩니다. 글은 왼쪽 위 칸에 남습니다.</li>
|
||||
<li>글 칸 하나를 클릭한 뒤 <b>위·아래·왼쪽 테두리</b>를 잡아 다른 글 칸으로 끌면 내용과 글자 서식이 함께 이동합니다. 오른쪽 경계는 너비 조절용입니다. 대상에 글이 있으면 덮어쓰기를 확인하고, <kbd>Esc</kbd>로 이동을 취소합니다.</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="goals-save">저장 실패와 연도 삭제</h3>
|
||||
<p>저장 성공 시 칸 테두리가 잠깐 초록으로 바뀝니다. 실패하면 빨간 테두리와 안내가 나오며 입력값은 유지됩니다. 다시 입력하거나 칸을 떠나면 재시도합니다. 저장 안 된 값이 있으면 영역·줄 추가, 병합, 내용 이동을 진행하기 전에 저장을 시도하고, 실패하면 해당 작업을 멈춥니다.</p>
|
||||
<p>저장 성공 시 칸 테두리가 잠깐 초록으로 바뀝니다. 실패하면 빨간 테두리와 안내가 나오며 입력값은 유지됩니다. 다시 입력하거나 칸을 떠나면 재시도합니다. 저장 안 된 값이 있으면 영역·줄 추가, 병합을 진행하기 전에 저장을 시도하고, 실패하면 해당 작업을 멈춥니다.</p>
|
||||
<p>저장되지 않은 초안은 내 브라우저에도 잠시 보관합니다. 다음에 같은 화면을 열면 복원하지만, 그 사이 다른 사람이 같은 칸을 바꿨으면 자동으로 덮어쓰지 않습니다. 저장 안 된 상태로 페이지를 떠나려 하면 브라우저가 확인합니다.</p>
|
||||
<p>관리자의 <span class="pjh-ui">연도 삭제</span>는 그 연도의 숫자·업무 영역·계획 글을 삭제합니다. 확인창에 연도를 직접 입력해야 진행되며 되돌릴 수 없습니다.</p>
|
||||
</section>
|
||||
|
||||
@@ -104,5 +104,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -100,5 +100,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -492,5 +492,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -70,5 +70,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20261007d" defer></script>
|
||||
<script src="/static/project.js?v=20261007e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
+3
-99
@@ -9182,12 +9182,6 @@
|
||||
if (ta.dataset.bound) return;
|
||||
ta.dataset.bound = "1";
|
||||
if (ta.tagName !== "TEXTAREA") window.PJGoalText.attach(ta);
|
||||
["top", "right", "bottom", "left"].forEach(function (edge) {
|
||||
const handle = document.createElement("span");
|
||||
handle.className = "pj-goal-move-edge"; handle.dataset.edge = edge;
|
||||
handle.title = "끌어서 내용과 서식 이동"; handle.setAttribute("aria-hidden", "true");
|
||||
ta.closest("td").appendChild(handle);
|
||||
});
|
||||
const r = textSaver.track(ta, ta.value);
|
||||
if (r === "restored") restored++;
|
||||
else if (r === "conflict") conflict++;
|
||||
@@ -9200,109 +9194,19 @@
|
||||
}
|
||||
bindTexts(table);
|
||||
window.PJGoalText.init(table, el("pj-goal-format"));
|
||||
let moveBusy = false, moveClickUntil = 0;
|
||||
function goalCellTd(node) {
|
||||
const td = node && node.closest && node.closest("tbody.pj-goal-area td.pj-goal-texttd");
|
||||
return td && table.contains(td) && td.querySelector(".pj-goal-text") ? td : null;
|
||||
}
|
||||
// 누른 글 칸 표시(테두리). 셀 테두리를 끌어 내용·서식 옮기기는 2026-10-07 요청으로 없앴다(회의록 표는 그대로).
|
||||
function setMoveActive(td) {
|
||||
table.querySelectorAll(".is-goal-active").forEach(function (cell) { cell.classList.remove("is-goal-active"); });
|
||||
if (td) td.classList.add("is-goal-active");
|
||||
}
|
||||
function moveBody(editor) {
|
||||
// 열의 기본 서식도 현재 표시값으로 명시해 연간·분기의 굵기가 이동 뒤 달라지지 않게 한다.
|
||||
const cs = getComputedStyle(editor), rgb = cs.color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
const defaults = { bold: Number(cs.fontWeight) >= 600 || cs.fontWeight === "bold", italic: cs.fontStyle === "italic",
|
||||
underline: (cs.textDecorationLine || "").includes("underline") };
|
||||
const size = Math.round(parseFloat(cs.fontSize)); if (size >= 10 && size <= 32) defaults.size = size;
|
||||
if (rgb) defaults.color = "#" + rgb.slice(1).map(function (v) { return Number(v).toString(16).padStart(2, "0"); }).join("");
|
||||
return window.PJGoalText.encode(window.PJGoalText.readRuns(editor).map(function (run) { return Object.assign({}, defaults, run); }));
|
||||
}
|
||||
function moveCell(sourceTd, targetTd) {
|
||||
if (moveBusy || sourceTd === targetTd) return;
|
||||
moveBusy = true;
|
||||
return withStruct(async function () {
|
||||
const source = sourceTd.querySelector(".pj-goal-text"), target = targetTd.querySelector(".pj-goal-text");
|
||||
const fields = [source, target], attrs = fields.map(function (n) { return n.getAttribute("contenteditable"); });
|
||||
try {
|
||||
if (!document.contains(sourceTd) || !document.contains(targetTd) || !source.value) return;
|
||||
fields.forEach(function (n) { n.setAttribute("contenteditable", "false"); n.closest("td").classList.add("is-goal-move-saving"); });
|
||||
await flushTexts();
|
||||
const sourceBody = source.value, targetBody = target.value;
|
||||
if (targetBody && !await confirm("대상 셀의 내용을 덮어쓸까요? 원본의 내용과 서식으로 바뀝니다.", { okText: "덮어쓰기", cancelText: "취소" })) return;
|
||||
const res = await api("POST", "/project/api/goals/cells/move", {
|
||||
source_row: source.dataset.row, source_month: source.dataset.month,
|
||||
target_row: target.dataset.row, target_month: target.dataset.month,
|
||||
source_body: sourceBody, target_body: targetBody, body: moveBody(source),
|
||||
});
|
||||
source.value = ""; target.value = res.body;
|
||||
textSaver.acceptSaved(source, ""); textSaver.acceptSaved(target, target.value);
|
||||
fit(source); fit(target); clearMergeSel(); setMoveActive(targetTd); flashSaved(targetTd);
|
||||
showToast("내용과 서식을 이동했습니다.");
|
||||
} catch (err) {
|
||||
showToast("셀 이동 실패: " + err.message + " — 두 칸의 화면 내용은 유지됩니다. 다시 시도하거나 새로고침해 저장 상태를 확인해 주세요.", "error");
|
||||
} finally {
|
||||
fields.forEach(function (n, i) {
|
||||
if (attrs[i] == null) n.removeAttribute("contenteditable"); else n.setAttribute("contenteditable", attrs[i]);
|
||||
n.closest("td").classList.remove("is-goal-move-saving");
|
||||
});
|
||||
moveBusy = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
// 선택한 셀의 테두리는 이동, 일반 본문 드래그는 기존 글/병합 범위 선택을 유지한다.
|
||||
table.addEventListener("mousedown", function (e) {
|
||||
if (e.button !== 0 || e.shiftKey) return;
|
||||
const source = goalCellTd(e.target), handle = e.target.closest(".pj-goal-move-edge");
|
||||
if (!source) return;
|
||||
if (!handle) { if (!moveBusy) setMoveActive(source); return; }
|
||||
e.preventDefault(); e.stopImmediatePropagation();
|
||||
if (moveBusy || !source.querySelector(".pj-goal-text").value) return;
|
||||
const startX = e.clientX, startY = e.clientY;
|
||||
let moving = false, target = null, frame = null, x = startX, y = startY;
|
||||
function updateTarget() {
|
||||
table.querySelectorAll(".is-goal-move-target").forEach(function (n) { n.classList.remove("is-goal-move-target"); });
|
||||
target = goalCellTd(document.elementFromPoint(x, y));
|
||||
if (target === source) target = null;
|
||||
if (target) target.classList.add("is-goal-move-target");
|
||||
}
|
||||
function scroll() {
|
||||
const r = pane.getBoundingClientRect();
|
||||
if (x >= r.left && x <= r.right && y >= r.top && y <= r.bottom) {
|
||||
if (x < r.left + 24) pane.scrollLeft -= 16; else if (x > r.right - 24) pane.scrollLeft += 16;
|
||||
if (y < r.top + 24) pane.scrollTop -= 16; else if (y > r.bottom - 24) pane.scrollTop += 16;
|
||||
}
|
||||
updateTarget(); frame = requestAnimationFrame(scroll);
|
||||
}
|
||||
function move(ev) {
|
||||
x = ev.clientX; y = ev.clientY;
|
||||
if (!moving && Math.hypot(x - startX, y - startY) < 4) return;
|
||||
if (!moving) {
|
||||
moving = true; source.classList.add("is-goal-moving");
|
||||
document.documentElement.classList.add("pj-goal-moving");
|
||||
const selection = window.getSelection(); if (selection) selection.removeAllRanges();
|
||||
frame = requestAnimationFrame(scroll);
|
||||
}
|
||||
updateTarget();
|
||||
}
|
||||
function end(ev) {
|
||||
if (frame !== null) cancelAnimationFrame(frame);
|
||||
document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", end);
|
||||
document.removeEventListener("keydown", key, true); window.removeEventListener("blur", cancel);
|
||||
source.classList.remove("is-goal-moving"); document.documentElement.classList.remove("pj-goal-moving");
|
||||
table.querySelectorAll(".is-goal-move-target").forEach(function (n) { n.classList.remove("is-goal-move-target"); });
|
||||
if (moving) moveClickUntil = Date.now() + 300;
|
||||
if (ev && moving && target) moveCell(source, target);
|
||||
}
|
||||
function cancel() { end(null); }
|
||||
function key(ev) { if (ev.key === "Escape") { ev.preventDefault(); ev.stopImmediatePropagation(); cancel(); } }
|
||||
document.addEventListener("mousemove", move); document.addEventListener("mouseup", end);
|
||||
document.addEventListener("keydown", key, true); window.addEventListener("blur", cancel);
|
||||
}, true);
|
||||
table.addEventListener("click", function (e) {
|
||||
if ((Date.now() < moveClickUntil && e.detail !== 0 && goalCellTd(e.target)) || e.target.closest(".pj-goal-move-edge")) {
|
||||
e.preventDefault(); e.stopImmediatePropagation();
|
||||
}
|
||||
const td = goalCellTd(e.target);
|
||||
if (td) setMoveActive(td);
|
||||
}, true);
|
||||
// 칸이 세로로 길어도(옆 칸 글이 길거나 세로 병합) 칸 아무 곳이나 누르면 그 칸 입력 — 커서는 글 끝(엑셀처럼).
|
||||
// 입력칸(textarea)은 글 높이만큼이라 그 아래를 누르면 아무것도 안 되던 것. Shift+클릭(범위 고르기)·끌기는 그대로.
|
||||
|
||||
Reference in New Issue
Block a user