From 040ce41a6b6e16c51ed538134ff86a1011a0fe19 Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Wed, 4 Sep 2024 15:39:25 +0200 Subject: [PATCH] fix: textarea height with multiline placeholder --- .../autocomplete-textarea.component.spec.ts | 2 +- .../autocomplete-textarea/autocomplete-textarea.component.ts | 2 +- .../src/lib/message-input/textarea/textarea.component.spec.ts | 2 +- .../src/lib/message-input/textarea/textarea.component.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts index 833f7abe..ba148b08 100644 --- a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts +++ b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts @@ -468,7 +468,7 @@ describe('AutocompleteTextareaComponent', () => { it('should set initial height of the textarea based on value received', () => { const textarea = queryTextarea(); - textarea!.value = 'This is my \n multiline message'; + component.value = 'This is my \n multiline message'; component.ngAfterViewInit(); fixture.detectChanges(); diff --git a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts index bd4d7ea4..6363885f 100644 --- a/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts +++ b/projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts @@ -229,7 +229,7 @@ export class AutocompleteTextareaComponent 'info', '[Autocomplete textarea] View inited' ); - if (this.messageInput.nativeElement.scrollHeight > 0) { + if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) { this.adjustTextareaHeight(); } } diff --git a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts index fe186b82..63d537f7 100644 --- a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts +++ b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts @@ -158,7 +158,7 @@ describe('TextareaComponent', () => { it('should set initial height of the textarea based on value received', () => { const textarea = queryTextarea(); - textarea!.value = 'This is my \n multiline message'; + component.value = 'This is my \n multiline message'; component.ngAfterViewInit(); fixture.detectChanges(); diff --git a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts index f7f3906b..41bd5be1 100644 --- a/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts +++ b/projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts @@ -94,7 +94,7 @@ export class TextareaComponent ngAfterViewInit(): void { this.isViewInited = true; - if (this.messageInput.nativeElement.scrollHeight > 0) { + if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) { this.adjustTextareaHeight(); } }