mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
fix icon clashes in adf-icon (#4258)
This commit is contained in:
parent
f00fd1ad01
commit
3a5fe3fb92
@ -9,12 +9,12 @@
|
||||
<div>
|
||||
<div><strong>Markup:</strong></div>
|
||||
<pre>
|
||||
<adf-icon value="alarm"></adf-icon></pre>
|
||||
<adf-icon value="folder"></adf-icon></pre>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div><strong>Result:</strong></div>
|
||||
<adf-icon value="alarm"></adf-icon>
|
||||
<adf-icon value="folder"></adf-icon>
|
||||
</div>
|
||||
|
||||
<h2>Named icons</h2>
|
||||
@ -50,10 +50,10 @@
|
||||
<div>
|
||||
<div><strong>Markup:</strong></div>
|
||||
<pre>
|
||||
<adf-icon value="image/gif"></adf-icon></pre>
|
||||
<adf-icon value="adf:folder"></adf-icon></pre>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div><strong>Result:</strong></div>
|
||||
<adf-icon value="image/gif"></adf-icon>
|
||||
<adf-icon value="adf:folder"></adf-icon>
|
||||
</div>
|
||||
|
@ -71,10 +71,11 @@ In the HTML, you can now use the icon as shown below:
|
||||
|
||||
### Thumbnail Service
|
||||
|
||||
You can also use icons registered with the [Thumbnail Service](thumbnail.service.md):
|
||||
You can also reference the icons registered with the [Thumbnail Service](thumbnail.service.md)
|
||||
by utilising the `adf:` namespace.
|
||||
|
||||
```html
|
||||
<adf-icon value="image/gif"></adf-icon>
|
||||
<adf-icon value="adf:image/gif"></adf-icon>
|
||||
```
|
||||
|
||||
## See also
|
||||
|
@ -21,7 +21,6 @@ import {
|
||||
ViewEncapsulation,
|
||||
ChangeDetectionStrategy
|
||||
} from '@angular/core';
|
||||
import { ThumbnailService } from '../services/thumbnail.service';
|
||||
import { ThemePalette } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
@ -47,14 +46,10 @@ export class IconComponent {
|
||||
@Input()
|
||||
set value(value: string) {
|
||||
this._value = value || 'settings';
|
||||
this._isCustom =
|
||||
this._value.includes(':') ||
|
||||
this.thumbnailService.mimeTypeIcons[value];
|
||||
this._isCustom = this._value.includes(':');
|
||||
}
|
||||
|
||||
get isCustom(): boolean {
|
||||
return this._isCustom;
|
||||
}
|
||||
|
||||
constructor(private thumbnailService: ThumbnailService) {}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import { NgModule } from '@angular/core';
|
||||
import { IconComponent } from './icon.component';
|
||||
import { MatIconModule } from '@angular/material';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ThumbnailService } from '../services/thumbnail.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -30,6 +31,9 @@ import { CommonModule } from '@angular/common';
|
||||
],
|
||||
exports: [
|
||||
IconComponent
|
||||
],
|
||||
providers: [
|
||||
ThumbnailService
|
||||
]
|
||||
})
|
||||
export class IconModule {}
|
||||
|
@ -157,7 +157,10 @@ export class ThumbnailService {
|
||||
|
||||
constructor(public contentService: ContentService, matIconRegistry: MatIconRegistry, sanitizer: DomSanitizer) {
|
||||
Object.keys(this.mimeTypeIcons).forEach((key) => {
|
||||
matIconRegistry.addSvgIcon(key, sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]));
|
||||
const url = sanitizer.bypassSecurityTrustResourceUrl(this.mimeTypeIcons[key]);
|
||||
|
||||
matIconRegistry.addSvgIcon(key, url);
|
||||
matIconRegistry.addSvgIconInNamespace('adf', key, url);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user