Skip to content

Commit 9dae196

Browse files
authored
Merge pull request #635 from GetStream/revert-textarea-changes
Revert textarea changes
2 parents c09544f + 9adc5c6 commit 9dae196

File tree

1 file changed

+4
-30
lines changed

1 file changed

+4
-30
lines changed

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

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { debounceTime } from 'rxjs/operators';
2828
import { TransliterationService } from '../../transliteration.service';
2929
import { EmojiInputService } from '../emoji-input.service';
3030
import { CustomTemplatesService } from '../../custom-templates.service';
31+
import { ThemeService } from '../../theme.service';
3132

3233
/**
3334
* The `AutocompleteTextarea` component is used by the [`MessageInput`](./MessageInputComponent.mdx) component to display the input HTML element where users can type their message.
@@ -132,6 +133,7 @@ export class AutocompleteTextareaComponent
132133
private transliterationService: TransliterationService,
133134
private emojiInputService: EmojiInputService,
134135
private customTemplatesService: CustomTemplatesService,
136+
private themeService: ThemeService,
135137
private cdRef: ChangeDetectorRef
136138
) {
137139
this.searchTerm$.pipe(debounceTime(300)).subscribe((searchTerm) => {
@@ -198,21 +200,13 @@ export class AutocompleteTextareaComponent
198200
}
199201
if (changes.value && !this.value && this.messageInput) {
200202
this.messageInput.nativeElement.style.height = 'auto';
201-
this.chatClientService?.chatClient?.logger?.(
202-
'info',
203-
'[Autocomplete textarea] Value reset, adjusting textarea height to auto'
204-
);
205203
this.updateMentionedUsersFromText();
206204
} else if (
207205
changes.value &&
208206
this.value &&
209207
this.messageInput &&
210208
this.isViewInited
211209
) {
212-
this.chatClientService?.chatClient?.logger?.(
213-
'info',
214-
'[Autocomplete textarea] Value changed'
215-
);
216210
setTimeout(() => {
217211
if (this.messageInput.nativeElement.scrollHeight > 0) {
218212
this.adjustTextareaHeight();
@@ -223,10 +217,6 @@ export class AutocompleteTextareaComponent
223217

224218
ngAfterViewInit(): void {
225219
this.isViewInited = true;
226-
this.chatClientService?.chatClient?.logger?.(
227-
'info',
228-
'[Autocomplete textarea] View inited'
229-
);
230220
if (this.messageInput.nativeElement.scrollHeight > 0) {
231221
this.adjustTextareaHeight();
232222
}
@@ -261,10 +251,6 @@ export class AutocompleteTextareaComponent
261251

262252
inputChanged() {
263253
this.valueChange.emit(this.messageInput.nativeElement.value);
264-
this.chatClientService?.chatClient?.logger?.(
265-
'info',
266-
'[Autocomplete textarea] Input changed'
267-
);
268254
this.adjustTextareaHeight();
269255
}
270256

@@ -281,20 +267,8 @@ export class AutocompleteTextareaComponent
281267
}
282268

283269
private adjustTextareaHeight() {
284-
const necessaryHeight = `${this.messageInput.nativeElement.scrollHeight}px`;
285-
if (this.messageInput.nativeElement.style.height === necessaryHeight) {
286-
this.chatClientService?.chatClient?.logger?.(
287-
'info',
288-
`[Autocomplete textarea] No need to adjust textarea height`
289-
);
290-
} else {
291-
this.chatClientService?.chatClient?.logger?.(
292-
'info',
293-
`[Autocomplete textarea] Adjusting textarea height to ${necessaryHeight}`
294-
);
295-
this.messageInput.nativeElement.style.height = '';
296-
this.messageInput.nativeElement.style.height = necessaryHeight;
297-
}
270+
this.messageInput.nativeElement.style.height = '';
271+
this.messageInput.nativeElement.style.height = `${this.messageInput.nativeElement.scrollHeight}px`;
298272
}
299273

300274
private transliterate(s: string) {

0 commit comments

Comments
 (0)