diff --git a/admin-lehrer/components/grid-editor/GridTable.tsx b/admin-lehrer/components/grid-editor/GridTable.tsx index 6b2d9c0..e395e52 100644 --- a/admin-lehrer/components/grid-editor/GridTable.tsx +++ b/admin-lehrer/components/grid-editor/GridTable.tsx @@ -107,12 +107,18 @@ export function GridTable({ const row = zone.rows.find((r) => r.index === rowIndex) if (!row) return Math.max(MIN_ROW_HEIGHT, avgRowHeightPx * scale) + // Multi-line cells (containing \n): expand height based on line count + const rowCells = zone.cells.filter((c) => c.row_index === rowIndex) + const maxLines = Math.max(1, ...rowCells.map((c) => (c.text ?? '').split('\n').length)) + if (maxLines > 1) { + const lineH = Math.max(MIN_ROW_HEIGHT, avgRowHeightPx * scale) + return lineH * maxLines + } + if (isHeader) { - // Headers keep their measured height const measuredH = row.y_max_px - row.y_min_px return Math.max(MIN_ROW_HEIGHT, measuredH * scale) } - // Content rows use average for uniformity return Math.max(MIN_ROW_HEIGHT, avgRowHeightPx * scale) } @@ -535,25 +541,52 @@ export function GridTable({ ))} ) : ( - onCellTextChange(cellId, e.target.value)} - onFocus={() => onSelectCell(cellId)} - onClick={(e) => { - if ((e.metaKey || e.ctrlKey) && onToggleCellSelection) { - e.preventDefault() - onToggleCellSelection(cellId) - } - }} - onKeyDown={(e) => handleKeyDown(e, cellId)} - className={`w-full px-2 bg-transparent border-0 outline-none ${ - isBold ? 'font-bold' : 'font-normal' - }`} - style={{ color: cellColor || undefined }} - spellCheck={false} - /> + {(cell?.text ?? '').includes('\n') ? ( +