@cdevhub/ngx-chat 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8221,19 +8221,25 @@ class ChatMessagesComponent {
|
|
|
8221
8221
|
// ===========================================================================
|
|
8222
8222
|
/**
|
|
8223
8223
|
* Programmatically scrolls to the bottom of the message list.
|
|
8224
|
-
* Uses
|
|
8224
|
+
* Uses setTimeout to ensure DOM is fully updated and measured before scrolling.
|
|
8225
8225
|
*/
|
|
8226
8226
|
scrollToBottom() {
|
|
8227
8227
|
const scrollbarInstance = this.scrollbar();
|
|
8228
8228
|
if (!scrollbarInstance)
|
|
8229
8229
|
return;
|
|
8230
|
-
// Use
|
|
8231
|
-
requestAnimationFrame
|
|
8230
|
+
// Use setTimeout(0) to push scroll to next macrotask after DOM is fully updated
|
|
8231
|
+
// requestAnimationFrame alone is not sufficient as scrollHeight may not be updated yet
|
|
8232
|
+
setTimeout(() => {
|
|
8233
|
+
const viewport = scrollbarInstance.viewport?.nativeElement;
|
|
8234
|
+
if (!viewport)
|
|
8235
|
+
return;
|
|
8236
|
+
// Calculate scroll position directly for reliability
|
|
8237
|
+
const scrollTop = viewport.scrollHeight - viewport.clientHeight;
|
|
8232
8238
|
scrollbarInstance.scrollTo({
|
|
8233
|
-
|
|
8239
|
+
top: scrollTop,
|
|
8234
8240
|
duration: 200,
|
|
8235
8241
|
});
|
|
8236
|
-
});
|
|
8242
|
+
}, 0);
|
|
8237
8243
|
}
|
|
8238
8244
|
/**
|
|
8239
8245
|
* Programmatically scrolls to a specific message by ID.
|
|
@@ -8848,7 +8854,7 @@ class ChatComponent {
|
|
|
8848
8854
|
}
|
|
8849
8855
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: ChatComponent, decorators: [{
|
|
8850
8856
|
type: Component,
|
|
8851
|
-
args: [{ selector: 'ngx-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent,
|
|
8857
|
+
args: [{ selector: 'ngx-chat', standalone: true, imports: [CommonModule, ChatHeaderComponent, ChatSenderComponent, ChatMessagesComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [ChatEventService], host: {
|
|
8852
8858
|
'class': 'ngx-chat',
|
|
8853
8859
|
'[class.ngx-chat--dark]': 'isDarkTheme()',
|
|
8854
8860
|
'[class.ngx-chat--light]': 'isLightTheme()',
|