diff --git a/src/components/tutor/ThirdStep.vue b/src/components/tutor/ThirdStep.vue index 6b8a775..a17cfad 100644 --- a/src/components/tutor/ThirdStep.vue +++ b/src/components/tutor/ThirdStep.vue @@ -9,8 +9,9 @@ const props = defineProps<{ action: () => {}; actionText?: string; disabled: boolean; - updateSyllabus: () => void; + updateSyllabus: (content: string) => void; restart: () => void; + updateSyllabusInDB: () => void; }>(); const isEditable: Ref = ref(false); @@ -26,9 +27,17 @@ const toggleFeedback = async () => { enableFeedback.value = !enableFeedback.value; }; -const handleTextEdit = (event, index) => { +const handleTextEdit = (event) => { const newValue = event.target.innerText; - props.updateSyllabus(index, newValue); + props.updateSyllabus(newValue); +}; + +const handleSyllabusEdition = () => { + if (isEditable.value) { + // Save the edited syllabus + props.updateSyllabusInDB(); + } + isEditable.value = !isEditable.value; };