This commit is contained in:
jliddev
2022-05-27 07:57:13 -05:00
parent 713bebd5e9
commit 3367b4eaca
2 changed files with 19 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
<h1 mat-dialog-title>{{ data.title }}</h1>
<div mat-dialog-content>
<div mat-dialog-content #dialogContent>
<pre class="message changelog" [innerHtml]="data.message"></pre>
</div>
<div mat-dialog-actions class="dialog-buttons">

View File

@@ -1,5 +1,7 @@
import { Component, Inject } from "@angular/core";
import { Component, ElementRef, Inject, ViewChild } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { LinkService } from "../../../services/links/link.service";
import { formatDynamicLinks } from "../../../utils/dom.utils";
export interface DialogData {
title: string;
@@ -14,14 +16,28 @@ export interface DialogData {
styleUrls: ["./confirm-dialog.component.scss"],
})
export class ConfirmDialogComponent {
@ViewChild("dialogContent", { read: ElementRef }) public dialogContent!: ElementRef;
public positiveKey: string;
public negativeKey: string;
public constructor(
public dialogRef: MatDialogRef<ConfirmDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: DialogData
@Inject(MAT_DIALOG_DATA) public data: DialogData,
private _linkService: LinkService
) {
this.positiveKey = data.positiveKey ?? "DIALOGS.CONFIRM.POSITIVE_BUTTON";
this.negativeKey = data.negativeKey ?? "DIALOGS.CONFIRM.NEGATIVE_BUTTON";
}
public ngAfterViewChecked(): void {
const descriptionContainer: HTMLDivElement = this.dialogContent?.nativeElement;
formatDynamicLinks(descriptionContainer, this.onOpenLink);
}
private onOpenLink = (element: HTMLAnchorElement): boolean => {
this._linkService.confirmLinkNavigation(element.href).subscribe();
return false;
};
}