diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/images/global-icon.component.ts | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/client/src/app/shared/images/global-icon.component.ts b/client/src/app/shared/images/global-icon.component.ts index a13b7d8e0..eb723db94 100644 --- a/client/src/app/shared/images/global-icon.component.ts +++ b/client/src/app/shared/images/global-icon.component.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core' | 1 | import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core' |
2 | import { HooksService } from '@app/core/plugins/hooks.service' | ||
2 | 3 | ||
3 | const icons = { | 4 | const icons = { |
4 | 'add': require('!!raw-loader?!../../../assets/images/global/add.svg'), | 5 | 'add': require('!!raw-loader?!../../../assets/images/global/add.svg'), |
@@ -60,11 +61,24 @@ export type GlobalIconName = keyof typeof icons | |||
60 | export class GlobalIconComponent implements OnInit { | 61 | export class GlobalIconComponent implements OnInit { |
61 | @Input() iconName: GlobalIconName | 62 | @Input() iconName: GlobalIconName |
62 | 63 | ||
63 | constructor (private el: ElementRef) {} | 64 | constructor ( |
65 | private el: ElementRef, | ||
66 | private hooks: HooksService | ||
67 | ) { } | ||
64 | 68 | ||
65 | ngOnInit () { | 69 | async ngOnInit () { |
66 | const nativeElement = this.el.nativeElement | 70 | const nativeElement = this.el.nativeElement |
67 | 71 | ||
68 | nativeElement.innerHTML = icons[this.iconName] | 72 | nativeElement.innerHTML = await this.hooks.wrapFun( |
73 | this.getSVGContent.bind(this), | ||
74 | { name: this.iconName }, | ||
75 | 'common', | ||
76 | 'filter:internal.common.svg-icons.get-content.params', | ||
77 | 'filter:internal.common.svg-icons.get-content.result' | ||
78 | ) | ||
79 | } | ||
80 | |||
81 | private getSVGContent (options: { name: string }) { | ||
82 | return icons[options.name] | ||
69 | } | 83 | } |
70 | } | 84 | } |