chore: store lesson content in localstorage

This commit is contained in:
Rotimi Best
2024-06-10 13:50:44 +01:00
parent 4a512a9bfb
commit 3b2893f7e8
@@ -130,6 +130,7 @@
} }
: $lesson; : $lesson;
console.log('updating lesson');
const [lessonRes] = await Promise.all([ const [lessonRes] = await Promise.all([
handleUpdateLessonMaterials(_lesson, lessonId), handleUpdateLessonMaterials(_lesson, lessonId),
saveOrUpdateTranslation($lesson.locale, lessonId) saveOrUpdateTranslation($lesson.locale, lessonId)
@@ -383,6 +384,10 @@
onChange={(html) => { onChange={(html) => {
if (mode === MODES.view) return; if (mode === MODES.view) return;
$lessonByTranslation[lessonId][$lesson.locale] = html; $lessonByTranslation[lessonId][$lesson.locale] = html;
try {
// Backup locale of lesson content
localStorage.setItem(`lesson-${lessonId}-${$lesson.locale}`, html);
} catch (error) {}
$isLessonDirty = true; $isLessonDirty = true;
}} }}
placeholder={$t('course.navItem.lessons.materials.tabs.note.placeholder')} placeholder={$t('course.navItem.lessons.materials.tabs.note.placeholder')}