@ -57,7 +57,7 @@ class InputField {
public inputFake : HTMLElement ;
public inputFake : HTMLElement ;
//public onLengthChange: (length: number, isOverflow: boolean) => void;
//public onLengthChange: (length: number, isOverflow: boolean) => void;
private wasInputFakeHeight : number ;
private wasInputFakeClient Height : number ;
private showScrollDebounced : ( ) = > void ;
private showScrollDebounced : ( ) = > void ;
constructor ( private options : {
constructor ( private options : {
@ -115,7 +115,7 @@ class InputField {
if ( options . animate ) {
if ( options . animate ) {
input . classList . add ( 'scrollable' , 'scrollable-y' ) ;
input . classList . add ( 'scrollable' , 'scrollable-y' ) ;
this . wasInputFakeHeight = 0 ;
this . wasInputFakeClient Height = 0 ;
this . showScrollDebounced = debounce ( ( ) = > this . input . classList . remove ( 'no-scrollbar' ) , 150 , false , true ) ;
this . showScrollDebounced = debounce ( ( ) = > this . input . classList . remove ( 'no-scrollbar' ) , 150 , false , true ) ;
this . inputFake = document . createElement ( 'div' ) ;
this . inputFake = document . createElement ( 'div' ) ;
this . inputFake . setAttribute ( 'contenteditable' , 'true' ) ;
this . inputFake . setAttribute ( 'contenteditable' , 'true' ) ;
@ -162,13 +162,13 @@ class InputField {
}
}
public onFakeInput() {
public onFakeInput() {
const scrollHeight = this . inputFake . scrollHeight ;
const { scrollHeight , clientHeight } = this . inputFake ;
if ( this . wasInputFakeHeight && this . wasInputFakeHeight !== s crol lHeight) {
if ( this . wasInputFakeClient Height && this . wasInputFakeClient Height !== client Height ) {
this . input . classList . add ( 'no-scrollbar' ) ; // ! в сафари может вообще не появиться скролл после анимации, так как ему нужен полный reflow блока с overflow.
this . input . classList . add ( 'no-scrollbar' ) ; // ! в сафари может вообще не появиться скролл после анимации, так как ему нужен полный reflow блока с overflow.
this . showScrollDebounced ( ) ;
this . showScrollDebounced ( ) ;
}
}
this . wasInputFakeHeight = s crol lHeight;
this . wasInputFakeClient Height = client Height ;
this . input . style . height = scrollHeight ? scrollHeight + 'px' : '' ;
this . input . style . height = scrollHeight ? scrollHeight + 'px' : '' ;
}
}