diff --git a/src/lib/components/Course/components/Lesson/Materials/index.svelte b/src/lib/components/Course/components/Lesson/Materials/index.svelte index c8747af8..4996b264 100644 --- a/src/lib/components/Course/components/Lesson/Materials/index.svelte +++ b/src/lib/components/Course/components/Lesson/Materials/index.svelte @@ -117,6 +117,9 @@ function updateNoteByCompletion(completion) { $lesson.materials.note = completion; + + autoSave($lesson.materials); + if (editorWindowRef) { const tmceBody = editorWindowRef?.document?.querySelector('body'); @@ -148,8 +151,7 @@ window.players = players; } - function autoSave(updatedMaterials, _isLoading: boolean, lessonId: string) { - isSaving = false; + function autoSave(updatedMaterials, _isLoading?: boolean, lessonId?: string) { if (timeoutId) clearTimeout(timeoutId); if (!initAutoSave) { @@ -160,7 +162,6 @@ isSaving = true; timeoutId = setTimeout(async () => { await saveLesson(updatedMaterials); - isSaving = false; }, 500); } @@ -169,8 +170,9 @@ $isLessonDirty = true; } - function onLessonIdChange() { + function onLessonIdChange(_lid: string) { initAutoSave = false; + isSaving = false; } const onClose = () => { @@ -249,6 +251,7 @@