fix: toggleDirection now reorders existing messages in DOM
This commit is contained in:
@@ -1624,6 +1624,10 @@ function toggleDirection() {
|
|||||||
localStorage.setItem('waterfallDirection', _waterfallDirection);
|
localStorage.setItem('waterfallDirection', _waterfallDirection);
|
||||||
const badge = document.getElementById('directionBadge');
|
const badge = document.getElementById('directionBadge');
|
||||||
if (badge) badge.textContent = _waterfallDirection === 'newest' ? 'NEW' : 'OLD';
|
if (badge) badge.textContent = _waterfallDirection === 'newest' ? 'NEW' : 'OLD';
|
||||||
|
const container = document.getElementById('chatContainer');
|
||||||
|
const items = Array.from(container.children);
|
||||||
|
items.reverse().forEach(el => container.appendChild(el));
|
||||||
|
scrollToLatest();
|
||||||
}
|
}
|
||||||
let _userScrolledAway = false;
|
let _userScrolledAway = false;
|
||||||
document.getElementById('chatContainer')?.addEventListener('scroll', function() {
|
document.getElementById('chatContainer')?.addEventListener('scroll', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user