fix text editor bug
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user