mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Use public API content URLs in viewer component
- Required a more sophisticated way to detect PDF content
This commit is contained in:
@@ -34,6 +34,9 @@ export class ViewerComponent {
|
||||
@Input()
|
||||
urlFile: string;
|
||||
|
||||
@Input()
|
||||
mimeType: string = null;
|
||||
|
||||
@Input()
|
||||
overlayMode: boolean = false;
|
||||
|
||||
@@ -63,8 +66,6 @@ export class ViewerComponent {
|
||||
if (this.urlFile) {
|
||||
this.nameFile = this.getFilenameFromUrl(this.urlFile);
|
||||
this.extension = this.getFileExtension(this.nameFile);
|
||||
|
||||
this.urlFile = this.addAlfrescoTicket(this.urlFile);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
@@ -116,7 +117,7 @@ export class ViewerComponent {
|
||||
* check if the current file is a suppoerted pdf extension
|
||||
*/
|
||||
private isPdf() {
|
||||
return this.extension === 'pdf';
|
||||
return this.extension === 'pdf' || this.mimeType == 'application/pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,22 +143,6 @@ export class ViewerComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Ticket to the file request
|
||||
* @returns {string}
|
||||
*/
|
||||
private addAlfrescoTicket(url: string) {
|
||||
return url + '?alf_ticket=' + this.getAlfrescoTicket();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token from the local storage
|
||||
* @returns {string}
|
||||
*/
|
||||
private getAlfrescoTicket() {
|
||||
return localStorage.getItem('token');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the othe possible menu in th eapplication
|
||||
*/
|
||||
|
Reference in New Issue
Block a user