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
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4

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