feat(project): add meeting cell editing
Apply project_db migration 019 to enable vertical cell merges. Other cell editing remains available before migration.
This commit is contained in:
@@ -0,0 +1,273 @@
|
||||
/* 주간 회의록 셀 편집. 글자 서식은 목표와 같은 PJGoalText/자동 저장을 사용한다. */
|
||||
(function () {
|
||||
"use strict";
|
||||
function init(opts) {
|
||||
const table = opts.table, pane = opts.pane, admin = opts.admin;
|
||||
const KEY = "pj_meet_col_w", widths = {}, defaults = {};
|
||||
const cols = Array.from(table.querySelectorAll("colgroup col"));
|
||||
let saver = null, selected = [], anchor = null, rangeDrag = null, moveDrag = null;
|
||||
let busy = false, undo = null, suppressClick = 0;
|
||||
const editableCell = n => {
|
||||
const td = n && n.closest && n.closest("td[data-meet-item]");
|
||||
return td && table.contains(td) && td.querySelector(".pj-meet-text") ? td : null;
|
||||
};
|
||||
const editorOf = td => td.querySelector(".pj-meet-text");
|
||||
const keyOf = td => (td.dataset.meetCols || "").split(",").filter(Boolean).at(-1);
|
||||
const minWidth = key => key === "section" ? 48 : key === "label" ? 96 : 40;
|
||||
cols.forEach(function (col) {
|
||||
const key = col.dataset.meetCol;
|
||||
defaults[key] = Math.max(minWidth(key), Math.round(col.getBoundingClientRect().width / opts.zoom()) || 160);
|
||||
widths[key] = defaults[key];
|
||||
});
|
||||
try {
|
||||
const saved = JSON.parse(localStorage.getItem(KEY) || "{}");
|
||||
Object.keys(widths).forEach(k => { if (Number.isFinite(saved[k]) && saved[k] > 0) widths[k] = Math.max(minWidth(k), saved[k]); });
|
||||
} catch (_) {}
|
||||
function applyWidths() {
|
||||
cols.forEach(col => { col.style.width = widths[col.dataset.meetCol] + "px"; });
|
||||
table.style.width = cols.reduce((sum, col) => sum + widths[col.dataset.meetCol], 0) + "px";
|
||||
table.style.minWidth = table.style.width;
|
||||
}
|
||||
function saveWidths() {
|
||||
try { localStorage.setItem(KEY, JSON.stringify(widths)); } catch (_) {}
|
||||
}
|
||||
function handles() {
|
||||
const keys = Array.from(table.querySelectorAll("colgroup col")).map(col => col.dataset.meetCol), occupied = [];
|
||||
Array.from(table.rows).forEach(function (tr, r) {
|
||||
occupied[r] = occupied[r] || [];
|
||||
let c = 0;
|
||||
Array.from(tr.cells).forEach(function (td) {
|
||||
while (occupied[r][c]) c++;
|
||||
const end = c + td.colSpan - 1;
|
||||
for (let rr = r; rr < r + td.rowSpan; rr++) {
|
||||
occupied[rr] = occupied[rr] || [];
|
||||
for (let cc = c; cc <= end; cc++) occupied[rr][cc] = true;
|
||||
}
|
||||
td.dataset.meetCols = keys.slice(c, end + 1).join(",");
|
||||
const handle = td.querySelector(".pj-meet-colresize") || document.createElement("span");
|
||||
handle.className = "pj-meet-colresize"; handle.dataset.col = keys[end];
|
||||
handle.title = "끌어서 너비 조절 · 더블클릭하면 내용에 맞춤";
|
||||
if (!handle.parentNode) td.appendChild(handle);
|
||||
if (admin && editableCell(td)) ["top", "bottom", "left"].forEach(function (edge) {
|
||||
if (td.querySelector('.pj-goal-move-edge[data-edge="' + edge + '"]')) return;
|
||||
const h = document.createElement("span"); h.className = "pj-goal-move-edge"; h.dataset.edge = edge;
|
||||
h.title = "테두리를 끌어 내용과 서식 이동"; td.appendChild(h);
|
||||
});
|
||||
c = end + 1;
|
||||
});
|
||||
});
|
||||
}
|
||||
handles(); applyWidths();
|
||||
const orderButton = document.getElementById("pj-meet-order");
|
||||
if (orderButton) new MutationObserver(handles).observe(table, { attributes: true, attributeFilter: ["class"] });
|
||||
function measure(td) {
|
||||
const probe = document.createElement("div"), copy = td.cloneNode(true);
|
||||
const t = table.cloneNode(false), section = td.parentElement.parentElement.cloneNode(false), row = td.parentElement.cloneNode(false);
|
||||
probe.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;width:max-content;left:0;top:0";
|
||||
probe.setAttribute("aria-hidden", "true");
|
||||
t.style.cssText = "width:max-content;table-layout:auto";
|
||||
copy.querySelectorAll(".pj-meet-colresize,.pj-goal-move-edge,.pj-meet-more,.pj-meet-sec-add").forEach(n => n.remove());
|
||||
copy.querySelectorAll("input,textarea,select").forEach(function (n) {
|
||||
const text = document.createElement("span"); text.textContent = n.value; n.replaceWith(text);
|
||||
});
|
||||
[t, section, row, copy].concat(Array.from(copy.querySelectorAll("*"))).forEach(function (n) {
|
||||
n.removeAttribute("id"); n.removeAttribute("contenteditable"); n.removeAttribute("data-placeholder");
|
||||
const styles = { position: "static", width: "max-content", "min-width": "0", "max-width": "none", height: "auto",
|
||||
overflow: "visible", "white-space": "pre", "overflow-wrap": "normal", "word-break": "normal" };
|
||||
Object.keys(styles).forEach(k => n.style.setProperty(k, styles[k], "important"));
|
||||
});
|
||||
copy.style.display = "block"; row.appendChild(copy); section.appendChild(row); t.appendChild(section); probe.appendChild(t); pane.appendChild(probe);
|
||||
try { return Math.ceil(copy.getBoundingClientRect().width / opts.zoom()) + 2; }
|
||||
finally { probe.remove(); }
|
||||
}
|
||||
function fit(key) {
|
||||
let width = minWidth(key);
|
||||
table.querySelectorAll("[data-meet-cols]").forEach(function (td) {
|
||||
const keys = td.dataset.meetCols.split(",");
|
||||
if (!keys.includes(key)) return;
|
||||
width = Math.max(width, measure(td) - keys.reduce((s, k) => s + (k === key ? 0 : widths[k]), 0));
|
||||
});
|
||||
widths[key] = width; applyWidths(); saveWidths();
|
||||
}
|
||||
function fitAll() {
|
||||
const cells = Array.from(table.querySelectorAll("[data-meet-cols]")).map(td => ({ keys: td.dataset.meetCols.split(","), width: measure(td) }));
|
||||
Object.keys(widths).forEach(k => { widths[k] = minWidth(k); });
|
||||
cells.filter(c => c.keys.length === 1).forEach(c => { widths[c.keys[0]] = Math.max(widths[c.keys[0]], c.width); });
|
||||
cells.filter(c => c.keys.length > 1).forEach(function (c) {
|
||||
const last = c.keys.at(-1), rest = c.keys.slice(0, -1).reduce((s, k) => s + widths[k], 0);
|
||||
widths[last] = Math.max(widths[last], c.width - rest);
|
||||
});
|
||||
applyWidths(); saveWidths();
|
||||
}
|
||||
function widthItems(td) {
|
||||
const key = keyOf(td);
|
||||
return key ? [
|
||||
{ label: "현재 열 너비 자동 맞춤", icon: opts.icon("fit_width"), onClick: () => fit(key) },
|
||||
{ label: "전체 열 너비 자동 맞춤", icon: opts.icon("width"), onClick: fitAll },
|
||||
] : [];
|
||||
}
|
||||
table.addEventListener("dblclick", function (e) {
|
||||
const h = e.target.closest(".pj-meet-colresize");
|
||||
if (h) { e.preventDefault(); e.stopPropagation(); fit(h.dataset.col); }
|
||||
});
|
||||
table.addEventListener("mousedown", function (e) {
|
||||
const h = e.target.closest(".pj-meet-colresize");
|
||||
if (!h || e.button !== 0) return;
|
||||
e.preventDefault(); e.stopPropagation();
|
||||
const key = h.dataset.col, x = e.clientX, before = widths[key];
|
||||
function move(ev) { widths[key] = Math.max(minWidth(key), Math.min(600, before + (ev.clientX - x) / opts.zoom())); applyWidths(); }
|
||||
function stop() { document.removeEventListener("mousemove", move); document.removeEventListener("mouseup", stop); window.removeEventListener("blur", stop); saveWidths(); }
|
||||
document.addEventListener("mousemove", move); document.addEventListener("mouseup", stop); window.addEventListener("blur", stop);
|
||||
});
|
||||
function paintSelection() {
|
||||
table.querySelectorAll(".is-merge-sel,.is-goal-active").forEach(td => td.classList.remove("is-merge-sel", "is-goal-active"));
|
||||
selected.forEach(td => td.classList.add("is-merge-sel"));
|
||||
if (selected.length === 1) selected[0].classList.add("is-goal-active");
|
||||
}
|
||||
function select(a, b) {
|
||||
if (!a || !b || a.closest("tbody") !== b.closest("tbody")) return;
|
||||
const rows = Array.from(a.closest("tbody").rows);
|
||||
const cells = Array.from(a.closest("tbody").querySelectorAll("td[data-meet-item]"));
|
||||
let start = Math.min(rows.indexOf(a.parentElement), rows.indexOf(b.parentElement));
|
||||
let end = Math.max(rows.indexOf(a.parentElement) + a.rowSpan - 1, rows.indexOf(b.parentElement) + b.rowSpan - 1);
|
||||
cells.forEach(function (td) {
|
||||
const i = rows.indexOf(td.parentElement);
|
||||
if (i <= end && i + td.rowSpan - 1 >= start) { start = Math.min(start, i); end = Math.max(end, i + td.rowSpan - 1); }
|
||||
});
|
||||
selected = cells.filter(td => { const i = rows.indexOf(td.parentElement); return i <= end && i + td.rowSpan - 1 >= start; });
|
||||
paintSelection();
|
||||
}
|
||||
function clearSelection() { selected = []; paintSelection(); }
|
||||
async function locked(fields, work) {
|
||||
if (busy || !saver) return;
|
||||
busy = true;
|
||||
const attrs = fields.map(e => e.getAttribute("contenteditable"));
|
||||
fields.forEach(e => { e.setAttribute("contenteditable", "false"); e.closest("td").classList.add("is-goal-move-saving"); });
|
||||
try { await saver.flush(); return await work(); }
|
||||
catch (err) { opts.toast("셀 편집 실패: " + err.message + " — 입력 내용은 화면에 유지됩니다.", "error"); }
|
||||
finally {
|
||||
fields.forEach((e, i) => { e.setAttribute("contenteditable", attrs[i]); e.closest("td").classList.remove("is-goal-move-saving"); });
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
function moveCell(a, b) {
|
||||
if (a === b) return;
|
||||
const source = editorOf(a), target = editorOf(b);
|
||||
return locked([source, target], async function () {
|
||||
const sourceBody = source.value, targetBody = target.value;
|
||||
if (!sourceBody) return;
|
||||
if (targetBody && !await opts.confirm("대상 셀의 내용을 덮어쓸까요? 내용과 서식이 함께 이동합니다.", { okText: "덮어쓰기", cancelText: "취소" })) return;
|
||||
const result = await opts.api("POST", "/project/api/goals/meeting-cells/move", {
|
||||
source_item: a.dataset.meetItem, target_item: b.dataset.meetItem, source_body: sourceBody, target_body: targetBody,
|
||||
});
|
||||
saver.replace(source, ""); saver.replace(target, result.body); clearSelection(); select(b, b);
|
||||
opts.toast("내용과 서식을 이동했습니다.");
|
||||
});
|
||||
}
|
||||
function clearCells(cells) {
|
||||
const fields = cells.map(editorOf).filter(e => e && e.value);
|
||||
return locked(fields, async function () {
|
||||
undo = fields.map(e => [e, e.value]);
|
||||
fields.forEach(e => { e.value = ""; });
|
||||
await Promise.all(fields.map(e => saver.save(e)));
|
||||
opts.toast("내용을 지웠습니다 — Ctrl+Z로 되돌리기");
|
||||
});
|
||||
}
|
||||
function undoClear() {
|
||||
const previous = (undo || []).filter(([e]) => e.isConnected); undo = null;
|
||||
return locked(previous.map(([e]) => e), async function () {
|
||||
previous.forEach(([e, value]) => { e.value = value; });
|
||||
await Promise.all(previous.map(([e]) => saver.save(e)));
|
||||
});
|
||||
}
|
||||
function mergeCells(cells) {
|
||||
const all = Array.from(table.querySelectorAll(".pj-meet-text"));
|
||||
return locked(all, async function () {
|
||||
await opts.api("POST", "/project/api/goals/meeting-cells/merge", { item_from: cells[0].dataset.meetItem, item_to: cells.at(-1).dataset.meetItem });
|
||||
saver.reload();
|
||||
});
|
||||
}
|
||||
function unmergeCells(cells) {
|
||||
return locked(Array.from(table.querySelectorAll(".pj-meet-text")), async function () {
|
||||
for (const td of cells) await opts.api("DELETE", "/project/api/goals/meeting-items/" + td.dataset.meetItem + "/cell-merge");
|
||||
saver.reload();
|
||||
});
|
||||
}
|
||||
function cancelMove() {
|
||||
moveDrag = null;
|
||||
table.querySelectorAll(".is-goal-move-target").forEach(td => td.classList.remove("is-goal-move-target"));
|
||||
document.documentElement.classList.remove("pj-goal-moving");
|
||||
}
|
||||
if (admin) {
|
||||
table.addEventListener("mousedown", function (e) {
|
||||
if (e.defaultPrevented || e.button !== 0 || busy) return;
|
||||
const td = editableCell(e.target); if (!td) return;
|
||||
if (e.target.closest(".pj-goal-move-edge")) {
|
||||
e.preventDefault(); e.stopPropagation(); rangeDrag = null;
|
||||
moveDrag = { source: td, target: null }; document.documentElement.classList.add("pj-goal-moving"); return;
|
||||
}
|
||||
if (e.shiftKey && anchor && anchor !== td && anchor.closest("tbody") === td.closest("tbody")) {
|
||||
e.preventDefault(); select(anchor, td); if (document.activeElement) document.activeElement.blur(); return;
|
||||
}
|
||||
anchor = td; select(td, td); rangeDrag = { start: td };
|
||||
});
|
||||
table.addEventListener("mouseover", function (e) {
|
||||
if (!rangeDrag || moveDrag) return;
|
||||
const td = editableCell(e.target);
|
||||
if (!td || td === rangeDrag.start || td.closest("tbody") !== rangeDrag.start.closest("tbody")) return;
|
||||
document.documentElement.classList.add("pj-goal-selecting");
|
||||
if (document.activeElement) document.activeElement.blur();
|
||||
window.getSelection().removeAllRanges(); select(rangeDrag.start, td);
|
||||
});
|
||||
document.addEventListener("mousemove", function (e) {
|
||||
if (!moveDrag) return;
|
||||
const td = editableCell(document.elementFromPoint(e.clientX, e.clientY));
|
||||
table.querySelectorAll(".is-goal-move-target").forEach(c => c.classList.remove("is-goal-move-target"));
|
||||
moveDrag.target = td && td !== moveDrag.source ? td : null;
|
||||
if (moveDrag.target) moveDrag.target.classList.add("is-goal-move-target");
|
||||
});
|
||||
document.addEventListener("mouseup", function () {
|
||||
rangeDrag = null; document.documentElement.classList.remove("pj-goal-selecting");
|
||||
if (!moveDrag) return;
|
||||
const { source, target } = moveDrag; cancelMove(); suppressClick = Date.now() + 300;
|
||||
if (target) moveCell(source, target);
|
||||
});
|
||||
table.addEventListener("click", function (e) { if (busy || (Date.now() < suppressClick && editableCell(e.target))) { e.preventDefault(); e.stopImmediatePropagation(); } }, true);
|
||||
document.addEventListener("keydown", function (e) {
|
||||
if (e.key === "Escape") { cancelMove(); rangeDrag = null; clearSelection(); document.documentElement.classList.remove("pj-goal-selecting"); }
|
||||
const active = document.activeElement;
|
||||
if (busy || (active && (active.isContentEditable || active.matches("textarea,input,select")))) return;
|
||||
if (e.key === "Delete" && selected.length) { e.preventDefault(); clearCells(selected.slice()); }
|
||||
else if ((e.ctrlKey || e.metaKey) && !e.shiftKey && e.key.toLowerCase() === "z" && undo) { e.preventDefault(); undoClear(); }
|
||||
});
|
||||
window.addEventListener("blur", function () { cancelMove(); rangeDrag = null; document.documentElement.classList.remove("pj-goal-selecting"); });
|
||||
document.addEventListener("mousedown", function (e) { if (!editableCell(e.target) && !e.target.closest(".pj-ctxmenu,.pj-goal-format")) clearSelection(); }, true);
|
||||
}
|
||||
table.addEventListener("contextmenu", function (e) {
|
||||
if (busy) { e.preventDefault(); e.stopImmediatePropagation(); return; }
|
||||
const td = e.target.closest("td,th"); if (!td || !table.contains(td)) return;
|
||||
if (admin && td.matches("th.pj-meet-c-label")) return; // 기존 줄 메뉴에 너비 항목을 붙인다.
|
||||
const cell = admin && editableCell(td), items = [];
|
||||
if (cell) {
|
||||
if (!selected.includes(cell)) select(cell, cell);
|
||||
const cells = selected.slice(), merged = cells.filter(c => c.rowSpan > 1);
|
||||
if (table.dataset.cellMerges === "true" && cells.length > 1) items.push({ label: "셀 병합 (세로)", icon: opts.icon("cell_merge"), onClick: () => mergeCells(cells) });
|
||||
if (merged.length) items.push({ label: "병합 해제", icon: opts.icon("call_split"), onClick: () => unmergeCells(merged) });
|
||||
if (cells.some(c => editorOf(c).value)) items.push({ label: "내용 지우기 (Del)", icon: opts.icon("ink_eraser"), onClick: () => clearCells(cells) });
|
||||
if (saver) {
|
||||
items.push(null,
|
||||
{ label: "위에 줄 추가", icon: opts.icon("add_row_above"), onClick: () => saver.addRow(cell.closest("tbody").dataset.section, cell.dataset.meetItem, "above") },
|
||||
{ label: "아래에 줄 추가", icon: opts.icon("add_row_below"), onClick: () => {
|
||||
const rows = Array.from(cell.closest("tbody").rows), bottom = rows[rows.indexOf(cell.parentElement) + cell.rowSpan - 1];
|
||||
saver.addRow(cell.closest("tbody").dataset.section, bottom.dataset.item, "below");
|
||||
} });
|
||||
}
|
||||
}
|
||||
if (items.length) items.push(null);
|
||||
items.push(...widthItems(td));
|
||||
if (items.length) { e.preventDefault(); opts.menu(e.clientX, e.clientY, items); }
|
||||
});
|
||||
return { bindSaver: s => { saver = s; }, widthItems: widthItems };
|
||||
}
|
||||
window.PJMeetingCells = { init: init };
|
||||
})();
|
||||
@@ -2649,6 +2649,14 @@ select.pj-meet-eval[data-v="done"], .pj-meet-eval-ro[data-v="done"] { color: #1f
|
||||
select.pj-meet-eval[data-v="partial"], .pj-meet-eval-ro[data-v="partial"] { color: #b45309; font-weight: 700; }
|
||||
select.pj-meet-eval[data-v="miss"], .pj-meet-eval-ro[data-v="miss"] { color: #c22b10; font-weight: 700; }
|
||||
.pj-meet-table td.is-none { vertical-align: top; padding: 6px 8px; font-size: 12px; }
|
||||
.pj-meet-table tbody td, .pj-meet-table tbody th { position: relative; }
|
||||
.pj-meet-colresize { position: absolute; top: 0; right: -3px; bottom: 0; width: 6px; z-index: 5; cursor: col-resize; }
|
||||
.pj-meet-colresize:hover { background: rgba(123, 104, 238, .22); }
|
||||
.pj-meet-table td.is-merge-sel, .pj-meet-table td.is-goal-active { box-shadow: inset 0 0 0 2px var(--pj-accent); }
|
||||
.pj-meet-table td.is-goal-move-target { box-shadow: inset 0 0 0 3px var(--pj-accent); background-image: linear-gradient(var(--pj-accent-tint), var(--pj-accent-tint)); }
|
||||
.pj-meet-table td.is-goal-move-saving { pointer-events: none; opacity: .65; }
|
||||
.pj-meet-ro span { line-height: normal; }
|
||||
@media print { .pj-meet-colresize, .pj-meet-table .pj-goal-move-edge { display: none !important; } }
|
||||
.pj-meet-table td.is-saved, .pj-meet-table th.is-saved, .pj-meet-notes textarea.is-saved, #pj-meet-attendees.is-saved {
|
||||
animation: pj-goal-saved 1s ease-out;
|
||||
}
|
||||
|
||||
+21
-6
@@ -10025,8 +10025,12 @@
|
||||
} catch (e) { create.disabled = false; showToast("만들기 실패: " + e.message, "error"); }
|
||||
});
|
||||
initMeetingSync(pane); // 보기만 하는 사람도(실적 권한이 있으면) 매출 자료 갱신
|
||||
if (!isAdmin) return;
|
||||
const table = el("pj-meet-table");
|
||||
const cellGrid = table && window.PJMeetingCells ? window.PJMeetingCells.init({
|
||||
table: table, pane: pane, admin: isAdmin, api: api, confirm: confirm, toast: showToast,
|
||||
menu: showContextMenu, icon: menuIcon, zoom: uiZoom,
|
||||
}) : null;
|
||||
if (!isAdmin) return;
|
||||
|
||||
function flashSaved(node) {
|
||||
if (!node) return;
|
||||
@@ -10035,6 +10039,7 @@
|
||||
node.classList.add("is-saved");
|
||||
}
|
||||
function fit(ta) {
|
||||
if (ta.tagName !== "TEXTAREA") { ta.style.removeProperty("height"); return; }
|
||||
if (!ta.offsetParent) return;
|
||||
ta.style.height = "auto";
|
||||
ta.style.height = ta.scrollHeight + "px";
|
||||
@@ -10220,6 +10225,7 @@
|
||||
}
|
||||
let restored = 0, conflict = 0;
|
||||
function bindText(ta) {
|
||||
if (ta.matches("[contenteditable]") && window.PJGoalText) window.PJGoalText.attach(ta);
|
||||
const r = textSaver.track(ta, ta.value);
|
||||
if (r === "restored") restored++;
|
||||
else if (r === "conflict") conflict++;
|
||||
@@ -10228,10 +10234,15 @@
|
||||
ta.addEventListener("blur", function () { textSaver.flush(ta).catch(function () {}); });
|
||||
}
|
||||
if (notes) bindText(notes);
|
||||
if (table) table.querySelectorAll("textarea.pj-meet-text").forEach(bindText);
|
||||
if (table) table.querySelectorAll(".pj-meet-text").forEach(bindText);
|
||||
if (cellGrid) cellGrid.bindSaver({ flush: flushAll, save: function (ta) { return textSaver.flush(ta); },
|
||||
replace: function (ta, value) { ta.value = value; textSaver.acceptSaved(ta, ta.value); },
|
||||
rowMenu: rowMenu, addRow: function (section, ref, place) { run(function () { return addRow(section, ref, place); }); },
|
||||
reload: reloadKeepScroll });
|
||||
if (table && window.PJGoalText) window.PJGoalText.init(table, el("pj-goal-format"));
|
||||
if (restored) showToast("저장되지 않았던 글 " + restored + "칸을 되살려 다시 저장합니다.");
|
||||
else if (conflict) showToast("다른 곳에서 바뀐 칸 " + conflict + "개는 예전 초안을 되살리지 않았습니다.");
|
||||
window.addEventListener("resize", function () { document.querySelectorAll("textarea.pj-meet-text, #pj-meet-notes").forEach(fit); });
|
||||
window.addEventListener("resize", function () { document.querySelectorAll(".pj-meet-text, #pj-meet-notes").forEach(fit); });
|
||||
// 페이지 떠남 — 글은 keepalive 로 한 번 더 보내고(보장 아님, 초안 백업이 남음), 실패·진행 중·금액 미저장이면 이탈 경고
|
||||
window.addEventListener("beforeunload", function (e) {
|
||||
textSaver.onBeforeUnload(e);
|
||||
@@ -10241,12 +10252,16 @@
|
||||
if (!table) return;
|
||||
// 칸이 세로로 길어도 칸 아무 곳이나 누르면 그 칸 입력(글·금액) — 커서는 끝
|
||||
table.addEventListener("click", function (e) {
|
||||
if (e.button !== 0 || e.target.closest("textarea, input, select, button, a, [data-meet-edit]")) return;
|
||||
if (e.button !== 0 || e.defaultPrevented || e.target.closest("textarea, input, select, button, a, [contenteditable], [data-meet-edit], .pj-meet-colresize, .pj-goal-move-edge")) return;
|
||||
const td = e.target.closest("td");
|
||||
const f = td && td.querySelector("textarea.pj-meet-text, input.pj-meet-amount");
|
||||
const f = td && td.querySelector(".pj-meet-text, input.pj-meet-amount");
|
||||
if (!f || f === document.activeElement) return;
|
||||
f.focus();
|
||||
if (f.tagName === "TEXTAREA") { const n = f.value.length; f.setSelectionRange(n, n); }
|
||||
else if (f.isContentEditable) {
|
||||
const range = document.createRange(); range.selectNodeContents(f); range.collapse(false);
|
||||
const selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range);
|
||||
}
|
||||
});
|
||||
// ── 달성률(지난주 결과 ÷ 지난주 목표) ──
|
||||
function paintRate(tr, result) {
|
||||
@@ -10354,7 +10369,7 @@
|
||||
return true;
|
||||
});
|
||||
} },
|
||||
]);
|
||||
].concat(cellGrid ? [null].concat(cellGrid.widthItems(tr.querySelector("th.pj-meet-c-label"))) : []));
|
||||
}
|
||||
table.addEventListener("click", function (e) {
|
||||
const b = e.target.closest("[data-meet-act]");
|
||||
|
||||
Reference in New Issue
Block a user