diff --git a/tabby-core/src/directives/fastHtmlBind.directive.ts b/tabby-core/src/directives/fastHtmlBind.directive.ts index 83dd864e..107a00bf 100644 --- a/tabby-core/src/directives/fastHtmlBind.directive.ts +++ b/tabby-core/src/directives/fastHtmlBind.directive.ts @@ -1,4 +1,5 @@ import { Directive, Input, ElementRef, OnChanges } from '@angular/core' +import { PlatformService } from '../api/platform' /** @hidden */ @Directive({ @@ -6,9 +7,19 @@ import { Directive, Input, ElementRef, OnChanges } from '@angular/core' }) export class FastHtmlBindDirective implements OnChanges { @Input() fastHtmlBind: string - constructor (private el: ElementRef) { } + + constructor ( + private el: ElementRef, + private platform: PlatformService, + ) { } ngOnChanges (): void { this.el.nativeElement.innerHTML = this.fastHtmlBind || '' + for (const link of this.el.nativeElement.querySelectorAll('a')) { + link.addEventListener('click', event => { + event.preventDefault() + this.platform.openExternal(link.href) + }) + } } }