From e4fa634a63c9b75663517cf367da5542a91cbd97 Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Fri, 20 Mar 2026 15:05:10 +0100 Subject: [PATCH] Fix GridTable: show cell.text when it diverges from word_boxes Post-processing steps like 5h (slash-IPA conversion) modify cell.text but not individual word_boxes. The colored per-word display showed stale word_box text instead of the corrected cell text. Now falls back to the plain input when texts don't match. Co-Authored-By: Claude Opus 4.6 --- admin-lehrer/components/grid-editor/GridTable.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 (