replace href with javascript to open links in external browser. issue #4

This commit is contained in:
Morgan McMillian 2017-06-20 10:28:03 -07:00
parent 83cb73cdf4
commit 8d8c9ff9bb

View file

@ -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);
}
}