Fix: Close typed not on new line

This commit is contained in:
Luc Mcgrady 2025-11-07 18:48:48 +00:00
parent 65954cb2a5
commit 0af6b4d2ef
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C

View file

@ -146,16 +146,18 @@ export class ReviewerState {
} }
async showTypedAnswer(html: string) { async showTypedAnswer(html: string) {
console.log({ data: this._cardData });
if (this._cardData?.typedAnswer === undefined) { if (this._cardData?.typedAnswer === undefined) {
return html; return html;
} }
const args = this._cardData.typedAnswer.args;
const compareAnswerResp = await compareAnswer({ const compareAnswerResp = await compareAnswer({
expected: this._cardData.typedAnswer.text, expected: this._cardData.typedAnswer.text,
provided: this.currentTypedAnswer, provided: this.currentTypedAnswer,
combining: !this._cardData.typedAnswer.args.includes("nc"), combining: !args.includes("nc"),
}); });
const display = compareAnswerResp.val;
const prefix = args.includes("cloze") ? "<br/>" : "";
const display = prefix + compareAnswerResp.val;
return html.replace(typedAnswerRegex, display); return html.replace(typedAnswerRegex, display);
} }