Skip to content

Commit 42fcdd6

Browse files
committed
fix: textarea height with multiline placeholder
1 parent f1570aa commit 42fcdd6

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ describe('AutocompleteTextareaComponent', () => {
473473

474474
it('should set initial height of the textarea based on value received', () => {
475475
const textarea = queryTextarea();
476-
textarea!.value = 'This is my \n multiline message';
476+
component.value = 'This is my \n multiline message';
477477
component.ngAfterViewInit();
478478
fixture.detectChanges();
479479

projects/stream-chat-angular/src/lib/message-input/autocomplete-textarea/autocomplete-textarea.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class AutocompleteTextareaComponent
208208
'info',
209209
'[Autocomplete textarea] View inited'
210210
);
211-
if (this.messageInput.nativeElement.scrollHeight > 0) {
211+
if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) {
212212
this.adjustTextareaHeight();
213213
}
214214
}

projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ describe('TextareaComponent', () => {
163163

164164
it('should set initial height of the textarea based on value received', () => {
165165
const textarea = queryTextarea();
166-
textarea!.value = 'This is my \n multiline message';
166+
component.value = 'This is my \n multiline message';
167167
component.ngAfterViewInit();
168168
fixture.detectChanges();
169169

projects/stream-chat-angular/src/lib/message-input/textarea/textarea.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class TextareaComponent
8181
}
8282

8383
ngAfterViewInit(): void {
84-
if (this.messageInput.nativeElement.scrollHeight > 0) {
84+
if (this.messageInput.nativeElement.scrollHeight > 0 && this.value) {
8585
this.adjustTextareaHeight();
8686
}
8787
}

0 commit comments

Comments
 (0)