|
|
@ -189,7 +189,7 @@ export default class ChatBubbles { |
|
|
|
//this.log('history_update', this.bubbles[mid], mid, message);
|
|
|
|
//this.log('history_update', this.bubbles[mid], mid, message);
|
|
|
|
|
|
|
|
|
|
|
|
if(this.scrollingToNewBubble) { |
|
|
|
if(this.scrollingToNewBubble) { |
|
|
|
this.scrollToNewLastBubble(); |
|
|
|
this.scrollToBubbleEnd(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//this.renderMessage(message, false, false, bubble);
|
|
|
|
//this.renderMessage(message, false, false, bubble);
|
|
|
@ -280,6 +280,7 @@ export default class ChatBubbles { |
|
|
|
if(message.media?.webpage && !bubble.querySelector('.web')) { |
|
|
|
if(message.media?.webpage && !bubble.querySelector('.web')) { |
|
|
|
getHeavyAnimationPromise().then(() => { |
|
|
|
getHeavyAnimationPromise().then(() => { |
|
|
|
this.renderMessage(message, true, false, bubble, false); |
|
|
|
this.renderMessage(message, true, false, bubble, false); |
|
|
|
|
|
|
|
this.scrollToBubbleIfLast(bubble); |
|
|
|
}); |
|
|
|
}); |
|
|
|
/* const mounted = this.getMountedBubble(mid); |
|
|
|
/* const mounted = this.getMountedBubble(mid); |
|
|
|
if(!mounted) return; |
|
|
|
if(!mounted) return; |
|
|
@ -332,6 +333,7 @@ export default class ChatBubbles { |
|
|
|
|
|
|
|
|
|
|
|
const updatePosition = this.chat.type === 'scheduled'; |
|
|
|
const updatePosition = this.chat.type === 'scheduled'; |
|
|
|
this.renderMessage(mounted.message, true, false, mounted.bubble, updatePosition); |
|
|
|
this.renderMessage(mounted.message, true, false, mounted.bubble, updatePosition); |
|
|
|
|
|
|
|
this.scrollToBubbleIfLast(mounted.bubble); |
|
|
|
|
|
|
|
|
|
|
|
if(updatePosition) { |
|
|
|
if(updatePosition) { |
|
|
|
(this.messagesQueuePromise || Promise.resolve()).then(() => { |
|
|
|
(this.messagesQueuePromise || Promise.resolve()).then(() => { |
|
|
@ -1249,7 +1251,7 @@ export default class ChatBubbles { |
|
|
|
//this.log('renderNewMessagesByIDs: messagesQueuePromise after', this.scrollable.isScrolledDown);
|
|
|
|
//this.log('renderNewMessagesByIDs: messagesQueuePromise after', this.scrollable.isScrolledDown);
|
|
|
|
//this.scrollable.scrollTo(this.scrollable.scrollHeight, 'top', true, true, 5000);
|
|
|
|
//this.scrollable.scrollTo(this.scrollable.scrollHeight, 'top', true, true, 5000);
|
|
|
|
//const bubble = this.bubbles[Math.max(...mids)];
|
|
|
|
//const bubble = this.bubbles[Math.max(...mids)];
|
|
|
|
this.scrollToNewLastBubble(); |
|
|
|
this.scrollToBubbleEnd(); |
|
|
|
|
|
|
|
|
|
|
|
//this.scrollable.scrollIntoViewNew(this.chatInner, 'end');
|
|
|
|
//this.scrollable.scrollIntoViewNew(this.chatInner, 'end');
|
|
|
|
|
|
|
|
|
|
|
@ -1281,9 +1283,7 @@ export default class ChatBubbles { |
|
|
|
return this.scrollable.scrollIntoViewNew(element, position, 4, undefined, forceDirection, forceDuration); |
|
|
|
return this.scrollable.scrollIntoViewNew(element, position, 4, undefined, forceDirection, forceDuration); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public scrollToNewLastBubble() { |
|
|
|
public scrollToBubbleEnd(bubble = this.chatInner.lastElementChild.lastElementChild as HTMLElement) { |
|
|
|
const bubble = this.chatInner.lastElementChild.lastElementChild as HTMLElement; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* if(DEBUG) { |
|
|
|
/* if(DEBUG) { |
|
|
|
this.log('scrollToNewLastBubble: will scroll into view:', bubble); |
|
|
|
this.log('scrollToNewLastBubble: will scroll into view:', bubble); |
|
|
|
} */ |
|
|
|
} */ |
|
|
@ -1296,6 +1296,13 @@ export default class ChatBubbles { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public scrollToBubbleIfLast(bubble: HTMLElement) { |
|
|
|
|
|
|
|
if(bubble.parentElement.lastElementChild === bubble && |
|
|
|
|
|
|
|
bubble.parentElement.parentElement.lastElementChild === bubble.parentElement) { |
|
|
|
|
|
|
|
this.scrollToBubbleEnd(bubble); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public highlightBubble(element: HTMLElement) { |
|
|
|
public highlightBubble(element: HTMLElement) { |
|
|
|
const datasetKey = 'highlightTimeout'; |
|
|
|
const datasetKey = 'highlightTimeout'; |
|
|
|
if(element.dataset[datasetKey]) { |
|
|
|
if(element.dataset[datasetKey]) { |
|
|
|