@ -78,6 +78,7 @@ import AppMediaViewer from "../appMediaViewer";
import SetTransition from "../singleTransition" ;
import SetTransition from "../singleTransition" ;
import handleHorizontalSwipe from "../../helpers/dom/handleHorizontalSwipe" ;
import handleHorizontalSwipe from "../../helpers/dom/handleHorizontalSwipe" ;
import { cancelContextMenuOpening } from "../misc" ;
import { cancelContextMenuOpening } from "../misc" ;
import findUpAttribute from "../../helpers/dom/findUpAttribute" ;
const USE_MEDIA_TAILS = false ;
const USE_MEDIA_TAILS = false ;
const IGNORE_ACTIONS : Set < Message.messageService [ ' action ' ] [ ' _ ' ] > = new Set ( [
const IGNORE_ACTIONS : Set < Message.messageService [ ' action ' ] [ ' _ ' ] > = new Set ( [
@ -980,8 +981,8 @@ export default class ChatBubbles {
return ;
return ;
}
}
const nameDiv = findUpClassName ( target , 'peer-title' ) || findUpClassName ( target , 'name' ) || findUpTag ( target , 'AVATAR-ELEMENT' ) ;
const nameDiv = findUpClassName ( target , 'peer-title' ) || findUpClassName ( target , 'name' ) || findUpTag ( target , 'AVATAR-ELEMENT' ) || findUpAttribute ( target , 'data-saved-from' ) ;
if ( nameDiv ) {
if ( nameDiv && nameDiv !== bubble ) {
target = nameDiv || target ;
target = nameDiv || target ;
const peerId = ( target . dataset . peerId || target . getAttribute ( 'peer' ) ) ;
const peerId = ( target . dataset . peerId || target . getAttribute ( 'peer' ) ) ;
const savedFrom = target . dataset . savedFrom ;
const savedFrom = target . dataset . savedFrom ;
@ -1517,7 +1518,7 @@ export default class ChatBubbles {
bubble = this . bubbles [ Math . max ( . . . mids ) ] ;
bubble = this . bubbles [ Math . max ( . . . mids ) ] ;
}
}
const promise = this . scrollToBubbleEnd ( bubble , true ) || Promise . resolve ( ) ;
const promise = this . scrollToBubbleEnd ( bubble ) || Promise . resolve ( ) ;
if ( isPaddingNeeded ) {
if ( isPaddingNeeded ) {
promise . then ( ( ) = > { // it will be called only once even if was set multiple times (that won't happen)
promise . then ( ( ) = > { // it will be called only once even if was set multiple times (that won't happen)
if ( middleware ( ) && isPaddingNeeded ) {
if ( middleware ( ) && isPaddingNeeded ) {
@ -1547,8 +1548,7 @@ export default class ChatBubbles {
element : HTMLElement ,
element : HTMLElement ,
position : ScrollLogicalPosition ,
position : ScrollLogicalPosition ,
forceDirection? : FocusDirection ,
forceDirection? : FocusDirection ,
forceDuration? : number ,
forceDuration? : number
isNewMessage? : boolean
) {
) {
// * 4 = .25rem
// * 4 = .25rem
const bubble = findUpClassName ( element , 'bubble' ) ;
const bubble = findUpClassName ( element , 'bubble' ) ;
@ -1562,6 +1562,7 @@ export default class ChatBubbles {
}
}
}
}
const isChangingHeight = this . chat . input . messageInput . classList . contains ( 'is-changing-height' ) || this . chat . container . classList . contains ( 'is-toggling-helper' ) ;
return this . scrollable . scrollIntoViewNew (
return this . scrollable . scrollIntoViewNew (
element ,
element ,
position ,
position ,
@ -1570,7 +1571,7 @@ export default class ChatBubbles {
forceDirection ,
forceDirection ,
forceDuration ,
forceDuration ,
'y' ,
'y' ,
isNewMessage ? ( { rect } ) = > {
isChangingHeight ? ( { rect } ) = > {
// return rect.height;
// return rect.height;
let height = windowSize . windowH ;
let height = windowSize . windowH ;
@ -1586,7 +1587,7 @@ export default class ChatBubbles {
) ;
) ;
}
}
public scrollToBubbleEnd ( bubble = this . getLastBubble ( ) , isNewMessage? : boolean ) {
public scrollToBubbleEnd ( bubble = this . getLastBubble ( ) ) {
/ * i f ( D E B U G ) {
/ * i f ( D E B U G ) {
this . log ( 'scrollToNewLastBubble: will scroll into view:' , bubble ) ;
this . log ( 'scrollToNewLastBubble: will scroll into view:' , bubble ) ;
} * /
} * /
@ -1594,7 +1595,7 @@ export default class ChatBubbles {
if ( bubble ) {
if ( bubble ) {
this . scrollingToBubble = bubble ;
this . scrollingToBubble = bubble ;
const middleware = this . getMiddleware ( ) ;
const middleware = this . getMiddleware ( ) ;
return this . scrollToBubble ( bubble , 'end' , undefined , undefined , isNewMessage ) . then ( ( ) = > {
return this . scrollToBubble ( bubble , 'end' , undefined , undefined ) . then ( ( ) = > {
if ( ! middleware ( ) ) return ;
if ( ! middleware ( ) ) return ;
this . scrollingToBubble = undefined ;
this . scrollingToBubble = undefined ;
} ) ;
} ) ;