fix(project): grow cells and repair Enter

This commit is contained in:
2026-10-03 17:04:02 +09:00
parent 090e508bf3
commit d3c1ca12e9
10 changed files with 219 additions and 23 deletions
+24
View File
@@ -8741,6 +8741,30 @@
{ label: "전체 열 너비 자동 맞춤", icon: menuIcon("view_week"), onClick: autoFitAllCols },
];
}
// 입력한 문단이 칸을 넘으면 해당 열만 늘린다. 명시적 개행·선택·초안은 유지한다.
const growingCells = new Set();
let growFrame = 0;
function queueCellGrowth(e) {
const field = e.target.closest("input, textarea, [contenteditable='true']");
const td = field && field.closest("td, th");
if (!isAdmin || !td || !table.contains(td)) return;
growingCells.add(td);
if (growFrame) return;
growFrame = requestAnimationFrame(function () {
growFrame = 0; let changed = false;
growingCells.forEach(function (cell) {
if (!table.contains(cell)) return;
const keys = (cell.dataset.goalCols || "").split(",").filter(Boolean), key = keys[keys.length - 1];
if (!colDefault[key]) return;
const width = naturalCellWidth(cell) - keys.slice(0, -1).reduce((sum, k) => sum + colW[k], 0);
if (width > colW[key]) { colW[key] = width; changed = true; }
});
growingCells.clear();
if (changed) { applyColW(); saveColW(); fitAll(); stickKpi(); }
});
}
table.addEventListener("input", queueCellGrowth);
table.addEventListener("compositionend", queueCellGrowth);
table.addEventListener("contextmenu", function (e) {
const td = e.target.closest("th, td");
if (!td || !table.contains(td)) return;