mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Fix scroll issue
This commit is contained in:
parent
8d7cb37003
commit
c18b36bcdc
@ -558,16 +558,20 @@ const ConversationPageConvPart = {
|
|||||||
//Reverse messages order
|
//Reverse messages order
|
||||||
response.reverse();
|
response.reverse();
|
||||||
|
|
||||||
//Save the current oldest message
|
|
||||||
var oldestMessage = convInfo.window.messagesTarget.firstChild;
|
|
||||||
|
|
||||||
//Process the list of messages in reverse order
|
//Process the list of messages in reverse order
|
||||||
response.forEach(function(message){
|
response.forEach(function(message){
|
||||||
ComunicWeb.pages.conversations.conversation.addMessage(message);
|
ComunicWeb.pages.conversations.conversation.addMessage(message);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Scroll to newest message
|
//Scroll to newest message
|
||||||
document.querySelector("[data-chatpage-msg-text-id=\""+response[0].ID+"\"]").scrollIntoView()
|
let el = document.querySelector("[data-chatpage-msg-text-id=\""+response[0].ID+"\"]")
|
||||||
|
if(el) {
|
||||||
|
el = el.parentNode
|
||||||
|
/** @type {HTMLDivElement} */
|
||||||
|
const parent = el.parentNode;
|
||||||
|
parent.scrollTop = el.offsetTop
|
||||||
|
console.log(parent, parent.scrollTop, el.offsetTop)
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user