Skip to content

Commit

Permalink
fixed #7755 - prevent release notes links from navigating away
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Jan 8, 2023
1 parent c57a7e7 commit 24f8a4b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tabby-core/src/directives/fastHtmlBind.directive.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { Directive, Input, ElementRef, OnChanges } from '@angular/core'
import { PlatformService } from '../api/platform'

/** @hidden */
@Directive({
selector: '[fastHtmlBind]',
})
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)
})
}
}
}

0 comments on commit 24f8a4b

Please sign in to comment.