2024-08-29 12:13:15 +01:00
|
|
|
import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core';
|
2024-09-10 16:01:51 +01:00
|
|
|
import { ModalController, PopoverController } from '@ionic/angular';
|
2024-08-29 12:13:15 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
2024-08-02 12:40:34 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-edit-message',
|
|
|
|
|
templateUrl: './edit-message.page.html',
|
|
|
|
|
styleUrls: ['./edit-message.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class EditMessagePage implements OnInit {
|
|
|
|
|
|
2024-08-29 12:13:15 +01:00
|
|
|
@ViewChild('messageInput', { static: false }) messageInput!: ElementRef<HTMLIonTextareaElement>;
|
2024-08-02 12:40:34 +01:00
|
|
|
@Input() message: string;
|
|
|
|
|
@Input() roomId: any;
|
|
|
|
|
|
2024-08-29 12:13:15 +01:00
|
|
|
oldMessage: string
|
2024-08-02 12:40:34 +01:00
|
|
|
|
|
|
|
|
constructor(
|
2024-09-10 16:01:51 +01:00
|
|
|
public popoverController: PopoverController,
|
2024-08-29 12:13:15 +01:00
|
|
|
public ThemeService: ThemeService,
|
|
|
|
|
) {}
|
2024-08-02 12:40:34 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2024-08-29 12:13:15 +01:00
|
|
|
this.oldMessage = this.message
|
|
|
|
|
}
|
|
|
|
|
ngAfterViewInit() {
|
|
|
|
|
// Focus the textarea once the view has been initialized
|
2024-09-10 21:45:46 +01:00
|
|
|
// this.messageInput.nativeElement.focus();
|
2024-08-02 12:40:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dismiss() {
|
2024-09-10 16:01:51 +01:00
|
|
|
this.popoverController.dismiss();
|
2024-08-02 12:40:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
save() {
|
2024-09-10 16:01:51 +01:00
|
|
|
this.popoverController.dismiss({
|
2024-08-02 12:40:34 +01:00
|
|
|
'message': this.message
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|