diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-05 17:26:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-05 17:26:58 +0100 |
commit | c2023a9f027deb310248ad751cc96a21a8e1ed03 (patch) | |
tree | 427caef09f6b121ce5d6fce86207cc12c54c0ebd /client/src/app/shared | |
parent | 3d9a63d3d824e753e95292b5e1343e1ebf9eaf71 (diff) | |
download | PeerTube-c2023a9f027deb310248ad751cc96a21a8e1ed03.tar.gz PeerTube-c2023a9f027deb310248ad751cc96a21a8e1ed03.tar.zst PeerTube-c2023a9f027deb310248ad751cc96a21a8e1ed03.zip |
Add ability to update icons content
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 | } |