fixed #7755 - prevent release notes links from navigating away

This commit is contained in:
Eugene Pankov
2023-01-08 20:09:26 +01:00
parent c57a7e73ea
commit 24f8a4bd43

View File

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