mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
parent
3c699a3379
commit
d27b02aaee
1 changed files with 8 additions and 3 deletions
|
|
@ -229,21 +229,26 @@ const Dashboard: React.FC = () => {
|
|||
console.log(selectedQuiz.content);
|
||||
selectedQuiz.content.forEach((question, qIndex) => {
|
||||
const formattedQuestion = question.trim();
|
||||
console.log(formattedQuestion);
|
||||
// console.log(formattedQuestion);
|
||||
if (formattedQuestion !== '') {
|
||||
quizContent += formattedQuestion;
|
||||
quizContent += formattedQuestion + '\n';
|
||||
if (qIndex !== selectedQuiz.content.length - 1) {
|
||||
quizContent += '\n';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!validateQuiz(selectedQuiz.content)) {
|
||||
window.alert('Attention! Ce quiz contient des questions invalides selon le format GIFT.');
|
||||
}
|
||||
const blob = new Blob([quizContent], { type: 'text/plain' });
|
||||
const a = document.createElement('a');
|
||||
const filename = title;
|
||||
a.download = `${filename}.txt`;
|
||||
a.download = `${filename}.gift`;
|
||||
a.href = window.URL.createObjectURL(blob);
|
||||
a.click();
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error exporting selected quiz:', error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue