@@ -200,13 +200,21 @@ export class AutocompleteTextareaComponent
200200 }
201201 if ( changes . value && ! this . value && this . messageInput ) {
202202 this . messageInput . nativeElement . style . height = 'auto' ;
203+ this . chatClientService . chatClient . logger (
204+ 'info' ,
205+ '[Autocomplete textarea] Value reset, adjusting textarea height to auto'
206+ ) ;
203207 this . updateMentionedUsersFromText ( ) ;
204208 } else if (
205209 changes . value &&
206210 this . value &&
207211 this . messageInput &&
208212 this . isViewInited
209213 ) {
214+ this . chatClientService . chatClient . logger (
215+ 'info' ,
216+ '[Autocomplete textarea] Value changed'
217+ ) ;
210218 setTimeout ( ( ) => {
211219 if ( this . messageInput . nativeElement . scrollHeight > 0 ) {
212220 this . adjustTextareaHeight ( ) ;
@@ -217,6 +225,10 @@ export class AutocompleteTextareaComponent
217225
218226 ngAfterViewInit ( ) : void {
219227 this . isViewInited = true ;
228+ this . chatClientService . chatClient . logger (
229+ 'info' ,
230+ '[Autocomplete textarea] View inited'
231+ ) ;
220232 if ( this . messageInput . nativeElement . scrollHeight > 0 ) {
221233 this . adjustTextareaHeight ( ) ;
222234 }
@@ -251,6 +263,10 @@ export class AutocompleteTextareaComponent
251263
252264 inputChanged ( ) {
253265 this . valueChange . emit ( this . messageInput . nativeElement . value ) ;
266+ this . chatClientService . chatClient . logger (
267+ 'info' ,
268+ '[Autocomplete textarea] Input changed'
269+ ) ;
254270 this . adjustTextareaHeight ( ) ;
255271 }
256272
@@ -267,8 +283,20 @@ export class AutocompleteTextareaComponent
267283 }
268284
269285 private adjustTextareaHeight ( ) {
270- this . messageInput . nativeElement . style . height = '' ;
271- this . messageInput . nativeElement . style . height = `${ this . messageInput . nativeElement . scrollHeight } px` ;
286+ const necessaryHeight = `${ this . messageInput . nativeElement . scrollHeight } px` ;
287+ if ( this . messageInput . nativeElement . style . height === necessaryHeight ) {
288+ this . chatClientService . chatClient . logger (
289+ 'info' ,
290+ `[Autocomplete textarea] No need to adjust textarea height`
291+ ) ;
292+ } else {
293+ this . chatClientService . chatClient . logger (
294+ 'info' ,
295+ `[Autocomplete textarea] Adjusting textarea height to ${ necessaryHeight } `
296+ ) ;
297+ this . messageInput . nativeElement . style . height = '' ;
298+ this . messageInput . nativeElement . style . height = necessaryHeight ;
299+ }
272300 }
273301
274302 private transliterate ( s : string ) {
0 commit comments