From 8d8c9ff9bbde3cf668958f3b8edcb4a44b65fedf Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Tue, 20 Jun 2017 10:28:03 -0700 Subject: [PATCH] replace href with javascript to open links in external browser. issue #4 --- src/pipes/parser/parser.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pipes/parser/parser.ts b/src/pipes/parser/parser.ts index f60e8bf..b4c68e5 100644 --- a/src/pipes/parser/parser.ts +++ b/src/pipes/parser/parser.ts @@ -15,6 +15,9 @@ export class ParserPipe implements PipeTransform { constructor(protected _sanitizer: DomSanitizer) {} transform(value: string, ...args): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl { + let hregex = /href="([\S]+)"/g; + // value = value.replace(hregex, "class=\"ex-link\" href="); + value = value.replace(hregex, "onClick=\"window.open('$1', '_system', 'location=yes')\""); return this._sanitizer.bypassSecurityTrustHtml(value); } }