대화방 > text 내 링크 연결.

This commit is contained in:
leejinho 2019-11-19 19:34:53 +09:00
parent 06a71351d3
commit 47dbd5d39a
4 changed files with 16 additions and 5 deletions

View File

@ -143,6 +143,10 @@ export class BrowserNativeService extends NativeService {
return new TranslateLoaderService(this, prefix, suffix); return new TranslateLoaderService(this, prefix, suffix);
} }
openDefaultBrowser(url: string): void {
open(url);
}
constructor(private httpClient: HttpClient) { constructor(private httpClient: HttpClient) {
super(); super();
this.notificationService = new NotificationService(); this.notificationService = new NotificationService();

View File

@ -1,4 +1,4 @@
import { ipcRenderer, remote } from 'electron'; import { ipcRenderer, remote, shell } from 'electron';
import { Observable, Subject } from 'rxjs'; import { Observable, Subject } from 'rxjs';
@ -29,6 +29,7 @@ import { StatusCode } from '@ucap-webmessenger/core';
export class ElectronNativeService implements NativeService { export class ElectronNativeService implements NativeService {
private ipcRenderer: typeof ipcRenderer; private ipcRenderer: typeof ipcRenderer;
private remote: typeof remote; private remote: typeof remote;
private shell: typeof shell;
private logoutSubject: Subject<void> | null = null; private logoutSubject: Subject<void> | null = null;
private logout$: Observable<void> | null = null; private logout$: Observable<void> | null = null;
@ -231,6 +232,10 @@ export class ElectronNativeService implements NativeService {
return new TranslateLoaderService(this, prefix, suffix); return new TranslateLoaderService(this, prefix, suffix);
} }
openDefaultBrowser(url: string): void {
this.shell.openExternal(url);
}
get isElectron() { get isElectron() {
return window && (window as any).process && (window as any).process.type; return window && (window as any).process && (window as any).process.type;
} }
@ -239,6 +244,7 @@ export class ElectronNativeService implements NativeService {
if (this.isElectron) { if (this.isElectron) {
this.ipcRenderer = (window as any).require('electron').ipcRenderer; this.ipcRenderer = (window as any).require('electron').ipcRenderer;
this.remote = (window as any).require('electron').remote; this.remote = (window as any).require('electron').remote;
this.shell = (window as any).require('electron').shell;
} }
} }
} }

View File

@ -41,4 +41,6 @@ export abstract class NativeService {
prefix?: string, prefix?: string,
suffix?: string suffix?: string
): TranslateLoader; ): TranslateLoader;
abstract openDefaultBrowser(url: string): void;
} }

View File

@ -38,9 +38,8 @@ export class TextComponent implements OnInit, AfterViewInit {
} }
onClickEvent(event: MouseEvent) { onClickEvent(event: MouseEvent) {
console.log('component', (event.target as HTMLAnchorElement).text); this.nativeService.openDefaultBrowser(
// this.nativeService.openDefaultBrowser( (event.target as HTMLAnchorElement).text
// (event.target as HTMLAnchorElement).text );
// );
} }
} }