open status from image galery, fix #627
This commit is contained in:
parent
1830212a91
commit
c0f84ddc11
|
@ -1,5 +1,8 @@
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<div class="image__alt" *ngIf="displayAltLabel">ALT</div>
|
<div class="image__alt" *ngIf="displayAltLabel">ALT</div>
|
||||||
|
<a *ngIf="status" href class="image__status" (click)="openStatus()" (auxclick)="openStatus()" title="open status">
|
||||||
|
<fa-icon class="image__status--icon" [icon]="faExternalLinkAlt"></fa-icon>
|
||||||
|
</a>
|
||||||
<a href class="image__link" (click)="openExternal()" (auxclick)="openExternal()" title="open image">
|
<a href class="image__link" (click)="openExternal()" (auxclick)="openExternal()" title="open image">
|
||||||
<fa-icon class="image__link--icon" [icon]="faLink"></fa-icon>
|
<fa-icon class="image__link--icon" [icon]="faLink"></fa-icon>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -25,11 +25,31 @@
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__status {
|
||||||
|
z-index: 10;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 25px;
|
||||||
|
padding: 5px 5px 8px 8px;
|
||||||
|
transition: all .2s;
|
||||||
|
opacity: 0;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
&--icon {
|
||||||
|
filter: drop-shadow(0 0 3px rgb(78, 78, 78));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&:hover &__link {
|
&:hover &__link {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover &__status {
|
||||||
|
opacity: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
&__alt {
|
&__alt {
|
||||||
display: inline;
|
display: inline;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||||
import { faLink } from "@fortawesome/free-solid-svg-icons";
|
import { faLink, faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
import { SettingsService } from '../../../../../services/settings.service';
|
import { SettingsService } from '../../../../../services/settings.service';
|
||||||
import { Attachment } from '../../../../../services/models/mastodon.interfaces';
|
import { Attachment } from '../../../../../services/models/mastodon.interfaces';
|
||||||
|
import { StatusWrapper } from '../../../../../models/common.model';
|
||||||
|
import { OpenThreadEvent } from '../../../../../services/tools.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-attachement-image',
|
selector: 'app-attachement-image',
|
||||||
|
@ -11,10 +13,13 @@ import { Attachment } from '../../../../../services/models/mastodon.interfaces';
|
||||||
})
|
})
|
||||||
export class AttachementImageComponent implements OnInit {
|
export class AttachementImageComponent implements OnInit {
|
||||||
faLink = faLink;
|
faLink = faLink;
|
||||||
|
faExternalLinkAlt = faExternalLinkAlt;
|
||||||
displayAltLabel: boolean;
|
displayAltLabel: boolean;
|
||||||
|
|
||||||
@Input() attachment: Attachment;
|
@Input() attachment: Attachment;
|
||||||
|
@Input() status: StatusWrapper;
|
||||||
@Output() openEvent = new EventEmitter();
|
@Output() openEvent = new EventEmitter();
|
||||||
|
@Output() browseThreadEvent = new EventEmitter<OpenThreadEvent>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly settingsService: SettingsService
|
private readonly settingsService: SettingsService
|
||||||
|
@ -34,4 +39,13 @@ export class AttachementImageComponent implements OnInit {
|
||||||
window.open(this.attachment.url, '_blank');
|
window.open(this.attachment.url, '_blank');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openStatus(): boolean {
|
||||||
|
if(!this.status) return false;
|
||||||
|
|
||||||
|
const openThreadEvent = new OpenThreadEvent(this.status.status, this.status.provider);
|
||||||
|
this.browseThreadEvent.next(openThreadEvent);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="statusSection === 'media'" class="status-media">
|
<div *ngIf="statusSection === 'media'" class="status-media">
|
||||||
<div *ngFor="let media of statusWrapper.status.media_attachments">
|
<div *ngFor="let media of statusWrapper.status.media_attachments">
|
||||||
<app-attachement-image *ngIf="media.type === 'image' || media.type === 'gifv'" class="status-media__image" [attachment]="media" (openEvent)="openAttachment(media)"></app-attachement-image>
|
<app-attachement-image *ngIf="media.type === 'image' || media.type === 'gifv'" class="status-media__image" [attachment]="media" [status]="statusWrapper" (openEvent)="openAttachment(media)" (browseThreadEvent)="browseThread($event)"></app-attachement-image>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue