mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-08-07 17:48:54 +00:00
Integration beetwen Viewer and Activiti Content (#1765)
* Provide a FormService event when you click on the uploaded content * Add a formContentClick event to the Form component * Provide a way to pass Blob to viewer * Provide a way to use the viewer using a Blob - Fix the pdf viewer - Fix the image viewer - Fix the media viewer * Update the viewer documentation * Use the ContentService provided by the core * Fix and improve unit test * Add unit test blob viewer
This commit is contained in:
committed by
Mario Romano
parent
016f0b3c09
commit
e9bd279259
@@ -31,6 +31,9 @@ export class ViewerComponent {
|
||||
@Input()
|
||||
urlFile: string = '';
|
||||
|
||||
@Input()
|
||||
blobFile: Blob;
|
||||
|
||||
@Input()
|
||||
fileNodeId: string = null;
|
||||
|
||||
@@ -43,6 +46,9 @@ export class ViewerComponent {
|
||||
@Input()
|
||||
showToolbar: boolean = true;
|
||||
|
||||
@Input()
|
||||
displayName: string;
|
||||
|
||||
@Output()
|
||||
showViewerChange: EventEmitter<boolean> = new EventEmitter<boolean>();
|
||||
|
||||
@@ -55,7 +61,6 @@ export class ViewerComponent {
|
||||
|
||||
urlFileContent: string;
|
||||
otherMenu: any;
|
||||
displayName: string;
|
||||
extension: string;
|
||||
mimeType: string;
|
||||
loaded: boolean = false;
|
||||
@@ -70,12 +75,16 @@ export class ViewerComponent {
|
||||
if (this.showViewer) {
|
||||
this.hideOtherHeaderBar();
|
||||
this.blockOtherScrollBar();
|
||||
if (!this.urlFile && !this.fileNodeId) {
|
||||
throw new Error('Attribute urlFile or fileNodeId is required');
|
||||
if (!this.urlFile && !this.blobFile && !this.fileNodeId) {
|
||||
throw new Error('Attribute urlFile or fileNodeId or blobFile is required');
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
let alfrescoApi = this.apiService.getInstance();
|
||||
if (this.urlFile) {
|
||||
if (this.blobFile) {
|
||||
this.mimeType = this.blobFile.type;
|
||||
this.extensionChange.emit(this.mimeType);
|
||||
resolve();
|
||||
} else if (this.urlFile) {
|
||||
let filenameFromUrl = this.getFilenameFromUrl(this.urlFile);
|
||||
this.displayName = filenameFromUrl ? filenameFromUrl : '';
|
||||
this.extension = this.getFileExtension(filenameFromUrl);
|
||||
|
Reference in New Issue
Block a user