From 6c730889be43da9d99b49141168b8cbc206888b9 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 25 May 2026 16:14:35 +0200 Subject: [PATCH] fix: word detection + highlighting for all pair types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove needsWordDetection guard — wordMap always populated - "Als Wort erstellen" banner shown for all types - Erkannte Wörter indicator shown for all types Co-Authored-By: Claude Sonnet 4.6 --- src/pages/StatementCreation.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/StatementCreation.jsx b/src/pages/StatementCreation.jsx index cb464fb..2f996f3 100644 --- a/src/pages/StatementCreation.jsx +++ b/src/pages/StatementCreation.jsx @@ -189,8 +189,8 @@ function PairForm({ objectId, onPairSaved }) { const [saving, setSaving] = useState(false); // Auto-detect words in sentence fields - const needsWordDetection = type === 'text' || type === 'question'; - const allText = needsWordDetection ? `${question} ${positive} ${negative}` : ''; + // Always detect words from all sentence fields (for all types) + const allText = `${question} ${positive} ${negative}`; useEffect(() => { if (!allText.trim()) { setWordMap({}); return; } const t = setTimeout(async () => { @@ -342,8 +342,8 @@ function PairForm({ objectId, onPairSaved }) { {type && (
- {/* Word creation banner (text/question) */} - {(type === 'text' || type === 'question') && selection && ( + {/* Word creation banner — shown for any type when text is selected */} + {selection && (
{selection}" @@ -462,8 +462,8 @@ function PairForm({ objectId, onPairSaved }) { )} - {/* Detected words indicator */} - {(type === 'text' || type === 'question') && Object.keys(wordMap).length > 0 && ( + {/* Detected words indicator — shown for all types */} + {Object.keys(wordMap).length > 0 && (
Erkannte Wörter: {Object.entries(wordMap).map(([title, w]) => (