fix text editor bug

This commit is contained in:
Rotimi Best
2023-09-11 13:15:50 +01:00
parent 35817f44b9
commit 3d58d58180
2 changed files with 10 additions and 7 deletions
@@ -148,7 +148,8 @@
window.players = players;
}
function autoSave(updatedMaterials, _isLoading) {
function autoSave(updatedMaterials, _isLoading: boolean, lessonId: string) {
isSaving = false;
if (timeoutId) clearTimeout(timeoutId);
if (!initAutoSave) {
@@ -161,7 +162,7 @@
await saveLesson(updatedMaterials);
isSaving = false;
}, 1500);
}, 500);
}
function handleInputChange() {
@@ -176,7 +177,7 @@
$uploadCourseVideoStore.isModalOpen = false;
};
$: autoSave($lesson.materials, $isLoading);
$: autoSave($lesson.materials, $isLoading, lessonId);
$: onLessonIdChange(lessonId);
+6 -4
View File
@@ -1,8 +1,8 @@
<script>
<script lang="ts">
import { PUBLIC_TINYMCE_API_KEY } from '$env/static/public';
import Editor from '@tinymce/tinymce-svelte';
export let value;
export let value: string;
export let onChange = (html = '') => {};
export let height = 300;
export let placeholder = '';
@@ -24,9 +24,9 @@
lists_indent_on_tab: false,
min_height: height,
placeholder: placeholder,
init_instance_callback: function (editor) {
init_instance_callback: function (editor: any) {
editorWindowRef = editor.iframeElement?.contentWindow;
editor.on('Input', function (e) {
editor.on('Input', function () {
const html = editor.getContent();
if (onChange) {
onChange(html);
@@ -34,6 +34,8 @@
});
}
};
$: value = !value ? '' : value;
</script>
<div>