CLASSROOMIO-T-214: scroll to bottom on add and wrap text

This commit is contained in:
Rotimi Best
2023-10-08 16:43:57 +01:00
parent 3999449e44
commit bf292068f4
@@ -50,11 +50,6 @@
}); });
comment = ''; comment = '';
setTimeout(() => {
bodyRef.scrollTo({
top: bodyRef.scrollHeight
});
}, 100);
} }
function handleKeyDown(e: KeyboardEvent) { function handleKeyDown(e: KeyboardEvent) {
@@ -98,6 +93,11 @@
} }
]; ];
$lesson.totalComments = comments.length; $lesson.totalComments = comments.length;
setTimeout(() => {
bodyRef.scrollTo({
top: bodyRef.scrollHeight
});
}, 100);
} }
async function fetchComments(people: GroupPerson[], lessonId?: string | null) { async function fetchComments(people: GroupPerson[], lessonId?: string | null) {
@@ -139,7 +139,6 @@
: lessonComment.groupmember.profile.fullname : lessonComment.groupmember.profile.fullname
}; };
}); });
// $lesson.totalComments = comments.length;
} }
onMount(async () => { onMount(async () => {
@@ -166,7 +165,7 @@
</div> </div>
</PageNav> </PageNav>
<div bind:this={bodyRef} class="overflow-auto h-[90%] px-2 min-w-[300px]"> <div bind:this={bodyRef} class="overflow-auto h-[90%] pb-10 px-2 min-w-[300px]">
{#each comments as comment} {#each comments as comment}
<div class="pb-2 mt-2"> <div class="pb-2 mt-2">
<div class="flex items-start"> <div class="flex items-start">
@@ -184,7 +183,7 @@
</p> </p>
</div> </div>
</div> </div>
<article class="prose prose-sm sm:prose ml-8"> <article class="prose prose-sm sm:prose ml-8 max-w-[350px]">
{comment.comment} {comment.comment}
</article> </article>
</div> </div>