@@ -200,13 +200,21 @@ export class AutocompleteTextareaComponent
200
200
}
201
201
if ( changes . value && ! this . value && this . messageInput ) {
202
202
this . messageInput . nativeElement . style . height = 'auto' ;
203
+ this . chatClientService . chatClient . logger (
204
+ 'info' ,
205
+ '[Autocomplete textarea] Value reset, adjusting textarea height to auto'
206
+ ) ;
203
207
this . updateMentionedUsersFromText ( ) ;
204
208
} else if (
205
209
changes . value &&
206
210
this . value &&
207
211
this . messageInput &&
208
212
this . isViewInited
209
213
) {
214
+ this . chatClientService . chatClient . logger (
215
+ 'info' ,
216
+ '[Autocomplete textarea] Value changed'
217
+ ) ;
210
218
setTimeout ( ( ) => {
211
219
if ( this . messageInput . nativeElement . scrollHeight > 0 ) {
212
220
this . adjustTextareaHeight ( ) ;
@@ -217,6 +225,10 @@ export class AutocompleteTextareaComponent
217
225
218
226
ngAfterViewInit ( ) : void {
219
227
this . isViewInited = true ;
228
+ this . chatClientService . chatClient . logger (
229
+ 'info' ,
230
+ '[Autocomplete textarea] View inited'
231
+ ) ;
220
232
if ( this . messageInput . nativeElement . scrollHeight > 0 ) {
221
233
this . adjustTextareaHeight ( ) ;
222
234
}
@@ -251,6 +263,10 @@ export class AutocompleteTextareaComponent
251
263
252
264
inputChanged ( ) {
253
265
this . valueChange . emit ( this . messageInput . nativeElement . value ) ;
266
+ this . chatClientService . chatClient . logger (
267
+ 'info' ,
268
+ '[Autocomplete textarea] Input changed'
269
+ ) ;
254
270
this . adjustTextareaHeight ( ) ;
255
271
}
256
272
@@ -267,8 +283,20 @@ export class AutocompleteTextareaComponent
267
283
}
268
284
269
285
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
+ }
272
300
}
273
301
274
302
private transliterate ( s : string ) {
0 commit comments