Skip to content

Commit

Permalink
Merge pull request #3278 from serlo/enable-math-elements-in-blanks-ex…
Browse files Browse the repository at this point in the history
…ercise

fix: enable math elements in blanks exercise
  • Loading branch information
hejtful authored Jan 15, 2024
2 parents 9dcd3cb + 6243c72 commit b541280
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion packages/editor/src/core/sub-document/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export function SubDocumentEditor({ id, pluginProps }: SubDocumentProps) {
// we overwrite it here (because it's probably because of tab navigation)
setTimeout(() => {
// fixes a bug in table plugin with disappearing buttons
if (e.target.nodeName?.toLowerCase() === 'button') return
if (['button', 'select'].includes(e.target.nodeName?.toLowerCase())) {
return
}

// find closest document
const target = (e.target as HTMLDivElement).closest('[data-document]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function createState() {
TextEditorFormattingOption.richTextBold,
TextEditorFormattingOption.richTextItalic,
TextEditorFormattingOption.textBlank,
TextEditorFormattingOption.math,
],
isInlineChildEditor: true,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,9 @@ export function FillInTheBlanksRenderer(props: FillInTheBlanksRendererProps) {
const trimmedBlankText =
textInBlanks.get(blankState.blankId)?.text.trim() ?? ''
const isCorrect = blankState.correctAnswers.some(
(correctAnswer) => correctAnswer.answer === trimmedBlankText
({ answer }) => answer === trimmedBlankText
)
newBlankAnswersCorrectList.set(blankState.blankId, {
isCorrect: isCorrect,
})
newBlankAnswersCorrectList.set(blankState.blankId, { isCorrect })
})

setFeedbackForBlanks(newBlankAnswersCorrectList)
Expand Down

0 comments on commit b541280

Please sign in to comment.