1
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
2
|
import { Component, OnInit } from '@angular/core';
|
3
|
import { DynamicDialogConfig, DynamicDialogRef } from "primeng/dynamicdialog";
|
4
|
import { JournalEntry } from '../../../../../../shared/models/journal-entry.interface';
|
5
|
import { JournalDialogEditService } from '../../../../../../shared/services/journal-dialog-edit.service';
|
6
|
|
7
|
@Component({
|
8
|
selector: 'app-journal-edit-dialog',
|
9
|
templateUrl: './journal-edit-dialog.component.html',
|
10
|
styleUrls: ['./journal-edit-dialog.component.scss']
|
11
|
})
|
12
|
export class JournalEditDialogComponent implements OnInit {
|
13
|
|
14
|
journal: JournalEntry;
|
15
|
iframeUrl: SafeResourceUrl;
|
16
|
|
17
|
constructor(public ref: DynamicDialogRef, public config: DynamicDialogConfig,
|
18
|
private journalDialogEditService: JournalDialogEditService,
|
19
|
public sanitizer: DomSanitizer) {
|
20
|
this.config.width = '95vw';
|
21
|
this.config.height = '85vh';
|
22
|
this.config.header = this.config.data.title;
|
23
|
this.journal = this.config.data.journalEntry;
|
24
|
}
|
25
|
|
26
|
ngOnInit(): void {
|
27
|
this.journalDialogEditService.getIframe(String(this.journal.id)).subscribe(url => {
|
28
|
this.iframeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url);
|
29
|
});
|
30
|
}
|
31
|
|
32
|
refreshIFrame(){
|
33
|
this.iframeUrl = this.sanitizer.bypassSecurityTrustResourceUrl((document.getElementById('theIFrame') as HTMLIFrameElement).src);
|
34
|
}
|
35
|
|
36
|
}
|