From 3b2893f7e8d37b518f53cee82de44b4e345056de Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Mon, 10 Jun 2024 13:50:44 +0100 Subject: [PATCH] chore: store lesson content in localstorage --- .../Course/components/Lesson/Materials/index.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/index.svelte b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/index.svelte index d434c66e..af11c0d7 100644 --- a/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/index.svelte +++ b/apps/dashboard/src/lib/components/Course/components/Lesson/Materials/index.svelte @@ -130,6 +130,7 @@ } : $lesson; + console.log('updating lesson'); const [lessonRes] = await Promise.all([ handleUpdateLessonMaterials(_lesson, lessonId), saveOrUpdateTranslation($lesson.locale, lessonId) @@ -383,6 +384,10 @@ onChange={(html) => { if (mode === MODES.view) return; $lessonByTranslation[lessonId][$lesson.locale] = html; + try { + // Backup locale of lesson content + localStorage.setItem(`lesson-${lessonId}-${$lesson.locale}`, html); + } catch (error) {} $isLessonDirty = true; }} placeholder={$t('course.navItem.lessons.materials.tabs.note.placeholder')}