Public Access
fix: resolve tsc-b build errors (Tex JSX type, Essay index sig, ExamRunner closure, vitest config)
This commit is contained in:
1 parent
61496b4b2f
commit
2b12223da6
5 files changed
+9
-6
No files matched your search
@@ -59,7 +59,8 @@ export default function ExamRunner({ exam, state, setState, onSubmit, onExit }:
|
||||
if (e.key === 'f') toggleFlag()
|
||||
if (/^[1-9]$/.test(e.key) && q.type === 'multiple-choice' && q.choices) {
|
||||
const ci = parseInt(e.key, 10) - 1
|
||||
if (q.choices[ci]) setState((s) => ({ ...s, answers: { ...s.answers, [q.id]: q.choices[ci].id } }))
|
||||
const choices = q.choices
|
||||
if (choices[ci]) setState((s) => ({ ...s, answers: { ...s.answers, [q.id]: choices[ci].id } }))
|
||||
}
|
||||
}
|
||||
window.addEventListener('keydown', handler)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import type React from 'react'
|
||||
import { renderLatex } from '../utils/latex'
|
||||
|
||||
interface TexProps {
|
||||
children?: string | null
|
||||
tag?: keyof JSX.IntrinsicElements
|
||||
tag?: keyof React.JSX.IntrinsicElements
|
||||
className?: string
|
||||
style?: React.CSSProperties
|
||||
}
|
||||
|
||||
// Safe: renderLatex only produces KaTeX-controlled HTML + HTML-escaped plain text.
|
||||
export default function Tex({ children, tag: Tag = 'span', className, style }: TexProps) {
|
||||
export default function Tex({ children, tag = 'span', className, style }: Readonly<TexProps>) {
|
||||
const Tag = tag as React.ElementType
|
||||
const html = String(children ?? '').split('\n').map(renderLatex).join('<br/>')
|
||||
return <Tag className={className} style={style} dangerouslySetInnerHTML={{ __html: html }} />
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import type { Question } from '../../types'
|
||||
interface EssayValue {
|
||||
text?: string
|
||||
selfGrade?: number
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
||||
Reference in new issue
Block a user