fix text editor bug
This commit is contained in:
@@ -148,7 +148,8 @@
|
|||||||
window.players = players;
|
window.players = players;
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoSave(updatedMaterials, _isLoading) {
|
function autoSave(updatedMaterials, _isLoading: boolean, lessonId: string) {
|
||||||
|
isSaving = false;
|
||||||
if (timeoutId) clearTimeout(timeoutId);
|
if (timeoutId) clearTimeout(timeoutId);
|
||||||
|
|
||||||
if (!initAutoSave) {
|
if (!initAutoSave) {
|
||||||
@@ -161,7 +162,7 @@
|
|||||||
await saveLesson(updatedMaterials);
|
await saveLesson(updatedMaterials);
|
||||||
|
|
||||||
isSaving = false;
|
isSaving = false;
|
||||||
}, 1500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleInputChange() {
|
function handleInputChange() {
|
||||||
@@ -176,7 +177,7 @@
|
|||||||
$uploadCourseVideoStore.isModalOpen = false;
|
$uploadCourseVideoStore.isModalOpen = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
$: autoSave($lesson.materials, $isLoading);
|
$: autoSave($lesson.materials, $isLoading, lessonId);
|
||||||
|
|
||||||
$: onLessonIdChange(lessonId);
|
$: onLessonIdChange(lessonId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { PUBLIC_TINYMCE_API_KEY } from '$env/static/public';
|
import { PUBLIC_TINYMCE_API_KEY } from '$env/static/public';
|
||||||
import Editor from '@tinymce/tinymce-svelte';
|
import Editor from '@tinymce/tinymce-svelte';
|
||||||
|
|
||||||
export let value;
|
export let value: string;
|
||||||
export let onChange = (html = '') => {};
|
export let onChange = (html = '') => {};
|
||||||
export let height = 300;
|
export let height = 300;
|
||||||
export let placeholder = '';
|
export let placeholder = '';
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
lists_indent_on_tab: false,
|
lists_indent_on_tab: false,
|
||||||
min_height: height,
|
min_height: height,
|
||||||
placeholder: placeholder,
|
placeholder: placeholder,
|
||||||
init_instance_callback: function (editor) {
|
init_instance_callback: function (editor: any) {
|
||||||
editorWindowRef = editor.iframeElement?.contentWindow;
|
editorWindowRef = editor.iframeElement?.contentWindow;
|
||||||
editor.on('Input', function (e) {
|
editor.on('Input', function () {
|
||||||
const html = editor.getContent();
|
const html = editor.getContent();
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
onChange(html);
|
onChange(html);
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$: value = !value ? '' : value;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user