diff --git a/admin-lehrer/components/grid-editor/GridTable.tsx b/admin-lehrer/components/grid-editor/GridTable.tsx index 083bbad..c128d96 100644 --- a/admin-lehrer/components/grid-editor/GridTable.tsx +++ b/admin-lehrer/components/grid-editor/GridTable.tsx @@ -131,6 +131,9 @@ export function GridTable({ const isBold = col.bold || cell?.is_bold const isLowConf = cell && cell.confidence > 0 && cell.confidence < 60 const cellColor = getCellColor(cell) + const hasColoredWords = cell?.word_boxes?.some( + (wb) => wb.color_name && wb.color_name !== 'black', + ) ?? false return ( wb.color_name !== 'black')?.color_name}`} /> )} - { - if (cell) onCellTextChange(cellId, e.target.value) - }} - onFocus={() => onSelectCell(cellId)} - onKeyDown={(e) => handleKeyDown(e, cellId)} - className={`w-full px-2 py-1.5 bg-transparent border-0 outline-none ${ - isBold ? 'font-bold' : 'font-normal' - } ${row.is_header ? 'text-base' : 'text-sm'}`} - style={cellColor ? { color: cellColor } : undefined} - spellCheck={false} - /> + {/* Per-word colored display when not editing */} + {hasColoredWords && !isSelected ? ( +
{ + onSelectCell(cellId) + setTimeout(() => document.getElementById(`cell-${cellId}`)?.focus(), 0) + }} + > + {cell!.word_boxes!.map((wb, i) => ( + + {wb.text} + {i < cell!.word_boxes!.length - 1 ? ' ' : ''} + + ))} +
+ ) : ( + { + if (cell) onCellTextChange(cellId, e.target.value) + }} + onFocus={() => onSelectCell(cellId)} + onKeyDown={(e) => handleKeyDown(e, cellId)} + className={`w-full px-2 py-1.5 bg-transparent border-0 outline-none ${ + isBold ? 'font-bold' : 'font-normal' + } ${row.is_header ? 'text-base' : 'text-sm'}`} + spellCheck={false} + /> + )} )