mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
4 commits
80a31f5b38
...
06b62cc869
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06b62cc869 | ||
|
|
7552cbae01 | ||
|
|
c396b60734 | ||
|
|
fc623582e0 |
3 changed files with 7 additions and 4 deletions
|
|
@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react';
|
|||
import Template, { ErrorTemplate } from './templates';
|
||||
import { parse } from 'gift-pegjs';
|
||||
import './styles.css';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { FormattedTextTemplate } from './templates/TextTypeTemplate';
|
||||
|
||||
interface GIFTTemplatePreviewProps {
|
||||
questions: string[];
|
||||
|
|
@ -74,7 +74,7 @@ const GIFTTemplatePreview: React.FC<GIFTTemplatePreviewProps> = ({
|
|||
<div className="error">{error}</div>
|
||||
) : isPreviewReady ? (
|
||||
<div data-testid="preview-container">
|
||||
<div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(items) }}></div>
|
||||
<div dangerouslySetInnerHTML={{ __html: FormattedTextTemplate({ format: 'html', text: items }) }}></div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="loading">Chargement de la prévisualisation...</div>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import katex from 'katex';
|
|||
import { TextFormat } from 'gift-pegjs';
|
||||
import DOMPurify from 'dompurify'; // cleans HTML to prevent XSS attacks, etc.
|
||||
|
||||
export function formatLatex(text: string): string {
|
||||
function formatLatex(text: string): string {
|
||||
return text
|
||||
.replace(/\$\$(.*?)\$\$/g, (_, inner) => katex.renderToString(inner, { displayMode: true }))
|
||||
.replace(/\$(.*?)\$/g, (_, inner) => katex.renderToString(inner, { displayMode: false }))
|
||||
|
|
|
|||
|
|
@ -26,8 +26,11 @@ const TeacherModeQuiz: React.FC<TeacherModeQuizProps> = ({
|
|||
const [feedbackMessage, setFeedbackMessage] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
// Close the feedback dialog when the question changes
|
||||
handleFeedbackDialogClose();
|
||||
setIsAnswerSubmitted(false);
|
||||
}, [questionInfos]);
|
||||
|
||||
}, [questionInfos.question]);
|
||||
|
||||
const handleOnSubmitAnswer = (answer: string | number | boolean) => {
|
||||
const idQuestion = Number(questionInfos.question.id) || -1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue