diff --git a/src/components/Exercises/FillBlanks.tsx b/src/components/Exercises/FillBlanks.tsx index f9e14a2a..0d7798d3 100644 --- a/src/components/Exercises/FillBlanks.tsx +++ b/src/components/Exercises/FillBlanks.tsx @@ -81,6 +81,7 @@ export default function FillBlanks({ const [isDrawerShowing, setIsDrawerShowing] = useState(false); const hasExamEnded = useExamStore((state) => state.hasExamEnded); + const allBlanks = Array.from(text.match(/({{\d+}})/g) || []).map((x) => x.replaceAll("{", "").replaceAll("}", "")); useEffect(() => { setTimeout(() => setIsDrawerShowing(!!currentBlankId), 100); @@ -138,6 +139,10 @@ export default function FillBlanks({ onCancel={() => setCurrentBlankId(undefined)} onAnswer={(solution: string) => { setAnswers((prev) => [...prev.filter((x) => x.id !== currentBlankId), {id: currentBlankId!, solution}]); + if (allBlanks.findIndex((x) => x === currentBlankId) + 1 < allBlanks.length) { + setCurrentBlankId(allBlanks[allBlanks.findIndex((x) => x === currentBlankId) + 1]); + return; + } setCurrentBlankId(undefined); }} />