mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-22 15:00:38 -04:00
Fix #1263
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user