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
+23
View File
@@ -106,6 +106,29 @@
{ label: "전체 열 너비 자동 맞춤", icon: opts.icon("width"), onClick: fitAll },
] : [];
}
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 (!admin || !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.meetCols || "").split(",").filter(Boolean), key = keys.at(-1);
if (!key) return;
const width = measure(cell) - keys.slice(0, -1).reduce((sum, k) => sum + widths[k], 0);
if (width > widths[key]) { widths[key] = width; changed = true; }
});
growingCells.clear();
if (changed) { applyWidths(); saveWidths(); }
});
}
table.addEventListener("input", queueCellGrowth);
table.addEventListener("compositionend", queueCellGrowth);
table.addEventListener("dblclick", function (e) {
const h = e.target.closest(".pj-meet-colresize");
if (h) { e.preventDefault(); e.stopPropagation(); fit(h.dataset.col); }