Compare commits

..

No commits in common. "8e8bff389419283a188d48ceebace53fe833845c" and "aa50af402e52b1c04c1822c93556fe9e1923056f" have entirely different histories.

3 changed files with 160 additions and 214 deletions

353
client/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -18,18 +18,18 @@
"@fortawesome/fontawesome-svg-core": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@mui/icons-material": "^7.0.2",
"@mui/icons-material": "^7.0.1",
"@mui/lab": "^5.0.0-alpha.153",
"@mui/material": "^7.0.2",
"@mui/material": "^7.0.1",
"@types/uuid": "^9.0.7",
"axios": "^1.8.1",
"dompurify": "^3.2.5",
"esbuild": "^0.25.2",
"gift-pegjs": "^2.0.0-beta.1",
"jest-environment-jsdom": "^29.7.0",
"jspdf": "^3.0.1",
"jspdf": "^2.5.2",
"jwt-decode": "^4.0.0",
"katex": "^0.16.22",
"katex": "^0.16.11",
"marked": "^15.0.8",
"nanoid": "^5.1.5",
"qrcode.react": "^4.2.0",
@ -74,7 +74,7 @@
"ts-jest": "^29.3.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.29.1",
"vite": "^6.2.6",
"vite": "^6.2.0",
"vite-plugin-environment": "^1.1.3"
}
}

View file

@ -65,7 +65,7 @@ const DownloadQuizModal: React.FC<DownloadQuizModalProps> = ({ quiz }) => {
if (!selectedQuiz) throw new Error('Quiz not found');
let previewHTML = '<h2>' + selectedQuiz.title + '</h2>';
let previewHTML = '';
selectedQuiz.content.forEach((giftQuestion) => {
try {
const question = parse(giftQuestion);
@ -76,9 +76,9 @@ const DownloadQuizModal: React.FC<DownloadQuizModalProps> = ({ quiz }) => {
});
} catch (error) {
if (error instanceof Error) {
previewHTML += ErrorTemplate(giftQuestion, error.message );
previewHTML += ErrorTemplate(giftQuestion + '\n' + error.message);
} else {
previewHTML += ErrorTemplate(giftQuestion, 'Erreur inconnue');
previewHTML += ErrorTemplate(giftQuestion + '\n' + 'Erreur inconnue');
}
}
});
@ -107,12 +107,11 @@ const DownloadQuizModal: React.FC<DownloadQuizModalProps> = ({ quiz }) => {
tempDiv.innerHTML = sanitizedHTML;
document.body.appendChild(tempDiv);
// allowTaint and useCORS are set to true to allow cross-origin images to be used in the canvas
const canvas = await html2canvas(tempDiv, { scale: 2, useCORS: true, allowTaint: true });
const canvas = await html2canvas(tempDiv, { scale: 2 });
document.body.removeChild(tempDiv);
const pdf = new jsPDF('p', 'mm', 'letter');
const pdf = new jsPDF('p', 'mm', 'a4');
const pageWidth = pdf.internal.pageSize.width;
const pageHeight = pdf.internal.pageSize.height;
const margin = 10;