diff --git a/admin-lehrer/components/grid-editor/GridTable.tsx b/admin-lehrer/components/grid-editor/GridTable.tsx index b4c1707..15f42cb 100644 --- a/admin-lehrer/components/grid-editor/GridTable.tsx +++ b/admin-lehrer/components/grid-editor/GridTable.tsx @@ -365,10 +365,18 @@ export function GridTable({ const isBold = col.bold || cell?.is_bold const isLowConf = cell && cell.confidence > 0 && cell.confidence < 60 const cellColor = getCellColor(cell) + // Show per-word colored display only when word_boxes + // match the cell text. Post-processing steps (e.g. 5h + // slash-IPA → bracket conversion) modify cell.text but + // not individual word_boxes, so we fall back to the + // plain input when they diverge. + const wbText = cell?.word_boxes?.map((wb) => wb.text).join(' ') ?? '' + const textMatches = !cell?.text || wbText === cell.text const hasColoredWords = - cell?.word_boxes?.some( + textMatches && + (cell?.word_boxes?.some( (wb) => wb.color_name && wb.color_name !== 'black', - ) ?? false + ) ?? false) return (