fix: ng2-alfresco-search

This commit is contained in:
Denys Vuika
2016-12-08 18:35:29 +00:00
parent f954930678
commit d973c39462
12 changed files with 45 additions and 11 deletions

View File

@@ -124,10 +124,25 @@ export class AlfrescoSearchAutocompleteComponent implements OnInit, OnChanges {
getMimeTypeIcon(node: any): string {
if (node.entry.content && node.entry.content.mimeType) {
let icon = this.alfrescoThumbnailService.getMimeTypeIcon(node.entry.content.mimeType);
return require(`./../img/${icon}`);
return this.resolveIconPath(icon);
}
}
resolveIconPath(icon: string): string {
let result = null;
try {
// webpack
result = require(`./../img/${icon}`);
} catch (e) {
// system.js
if (module && module.id) {
let baseComponentPath = module.id.replace('/components/alfresco-search-autocomplete.component.js', '');
result = `${baseComponentPath}/img/${icon}`;
}
}
return result;
}
/**
* Gets thumbnail message key for the given document node, which can be used to look up alt text
* @param node Node to get URL for.