diff --git a/src/app/components/main-chat/chat-content/chat-content.component.html b/src/app/components/main-chat/chat-content/chat-content.component.html index 2335f21..6a37c90 100644 --- a/src/app/components/main-chat/chat-content/chat-content.component.html +++ b/src/app/components/main-chat/chat-content/chat-content.component.html @@ -35,5 +35,6 @@ [currentChannel]="currentChannel" (newMsgEmitter)="editMsgEmitter($event)" [target]="'chats'" + [viewWidth]="viewWidth" > diff --git a/src/app/components/main-chat/chat-msg-box/chat-msg-box.component.ts b/src/app/components/main-chat/chat-msg-box/chat-msg-box.component.ts index cf55b05..d4d40ec 100644 --- a/src/app/components/main-chat/chat-msg-box/chat-msg-box.component.ts +++ b/src/app/components/main-chat/chat-msg-box/chat-msg-box.component.ts @@ -22,6 +22,7 @@ import { User } from '../../../interface/user.interface'; import { MessageData } from '../../../interface/chat.interface'; import { TranslateModule } from '@ngx-translate/core'; import { Channel } from '../../../interface/channel.interface'; +import { SharedService } from '../../../service/shared.service'; @Component({ selector: 'app-chat-msg-box', @@ -40,6 +41,7 @@ import { Channel } from '../../../interface/channel.interface'; export class ChatMsgBoxComponent { @Input() currentChannel: string = ''; @Input() target: string = ''; + @Input() viewWidth: number = 0; @Output() newMsgEmitter: EventEmitter = new EventEmitter(); @ViewChild('textarea') textAreaRef!: ElementRef; @@ -68,9 +70,12 @@ export class ChatMsgBoxComponent { public userService: UserService, private chatService: ChatService, public channelService: ChannleService, - public toggleBoolean: ToggleBooleanService + public toggleBoolean: ToggleBooleanService, + private sharedService: SharedService ) {} + RESPONSIVE_THRESHOLD_MOBILE = this.sharedService.RESPONSIVE_THRESHOLD_MOBILE; + /** * Handles the output from the emoji picker. * @param $event The selected emoji. @@ -83,7 +88,12 @@ export class ChatMsgBoxComponent { * Select Textarea at onload. */ ngAfterViewInit() { - this.textAreaRef.nativeElement.select(); + if ( + this.viewWidth != 0 && + this.viewWidth >= this.RESPONSIVE_THRESHOLD_MOBILE + ) { + this.textAreaRef.nativeElement.select(); + } } /**