create iframe view and fix preview map

This commit is contained in:
MathieuG-P
2022-12-07 20:58:46 +01:00
parent 57e0c73a31
commit 77bc6236f8
5 changed files with 43 additions and 20 deletions
+13 -6
View File
@@ -1,13 +1,14 @@
import { IframeModal } from "renderer/components/modal/modal-types/iframe-modal.component";
import { Observable } from "rxjs";
import { Subject } from "rxjs";
import { IpcService } from "./ipc.service";
import { ModalService } from "./modale.service";
export class LinkOpenerService{
private static instance: LinkOpenerService;
private readonly ipcService: IpcService;
private readonly modals: ModalService;
private readonly _iframeLink$: Subject<string> = new Subject();
public static getInstance(): LinkOpenerService{
if(!LinkOpenerService.instance){ LinkOpenerService.instance = new LinkOpenerService(); }
@@ -16,15 +17,21 @@ export class LinkOpenerService{
private constructor(){
this.ipcService = IpcService.getInstance();
this.modals = ModalService.getInsance();
}
public open(url: string, internal?: boolean): void{
if(internal){
this.modals.openModal(IframeModal, url);
return;
return this._iframeLink$.next(url);
}
this.ipcService.sendLazy("new-window", {args: url});
}
public closeIframe(){
this._iframeLink$.next(null);
}
public get iframeLink$(): Observable<string>{
return this._iframeLink$.asObservable();
}
}