mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
[SM-607] fix BitIcon innerHTML rerender removing click handler (#4949)
* remove innerHTML getter; update tests * remove template; use hostbinding
This commit is contained in:
parent
0ff3c679c9
commit
9d4d340930
@ -1,5 +1,5 @@
|
||||
import { Component, HostBinding, Input } from "@angular/core";
|
||||
import { DomSanitizer } from "@angular/platform-browser";
|
||||
import { DomSanitizer, SafeHtml } from "@angular/platform-browser";
|
||||
|
||||
import { Icon, isIcon } from "./icon";
|
||||
|
||||
@ -8,17 +8,17 @@ import { Icon, isIcon } from "./icon";
|
||||
template: ``,
|
||||
})
|
||||
export class BitIconComponent {
|
||||
@Input() icon: Icon;
|
||||
|
||||
@HostBinding()
|
||||
protected get innerHtml() {
|
||||
if (!isIcon(this.icon)) {
|
||||
return "";
|
||||
@Input() set icon(icon: Icon) {
|
||||
if (!isIcon(icon)) {
|
||||
this.innerHtml = "";
|
||||
return;
|
||||
}
|
||||
|
||||
const svg = this.icon.svg;
|
||||
return this.domSanitizer.bypassSecurityTrustHtml(svg);
|
||||
const svg = icon.svg;
|
||||
this.innerHtml = this.domSanitizer.bypassSecurityTrustHtml(svg);
|
||||
}
|
||||
|
||||
@HostBinding() innerHtml: SafeHtml;
|
||||
|
||||
constructor(private domSanitizer: DomSanitizer) {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user