Sengi-Windows-MacOS-Linux/src/app/components/stream/status/attachements/attachement-image/attachement-image.component.ts

38 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-04-15 05:42:18 +02:00
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
2020-04-15 06:42:51 +02:00
import { faLink } from "@fortawesome/free-solid-svg-icons";
2020-04-15 04:12:07 +02:00
import { SettingsService } from '../../../../../services/settings.service';
2020-04-15 04:12:07 +02:00
import { Attachment } from '../../../../../services/models/mastodon.interfaces';
@Component({
selector: 'app-attachement-image',
templateUrl: './attachement-image.component.html',
styleUrls: ['./attachement-image.component.scss']
})
export class AttachementImageComponent implements OnInit {
2020-04-15 06:42:51 +02:00
faLink = faLink;
displayAltLabel: boolean;
2020-04-15 06:42:51 +02:00
2020-04-15 04:12:07 +02:00
@Input() attachment: Attachment;
2020-04-15 05:42:18 +02:00
@Output() openEvent = new EventEmitter();
2020-04-15 04:12:07 +02:00
constructor(
private readonly settingsService: SettingsService
) {
this.displayAltLabel = this.settingsService.getSettings().enableAltLabel;
}
2020-04-15 04:12:07 +02:00
ngOnInit() {
}
2020-04-15 05:42:18 +02:00
attachmentSelected(): boolean {
this.openEvent.next();
return false;
}
2020-04-15 06:42:51 +02:00
openExternal(): boolean {
window.open(this.attachment.url, '_blank');
return false;
}
2020-04-15 04:12:07 +02:00
}