mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +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
@@ -15,7 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||
import { ContentService } from 'ng2-alfresco-core';
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
@@ -23,17 +24,27 @@ import { Component, Input } from '@angular/core';
|
||||
templateUrl: './imgViewer.component.html',
|
||||
styleUrls: ['./imgViewer.component.css']
|
||||
})
|
||||
export class ImgViewerComponent {
|
||||
export class ImgViewerComponent implements OnChanges {
|
||||
|
||||
@Input()
|
||||
urlFile: string;
|
||||
|
||||
@Input()
|
||||
blobFile: any;
|
||||
|
||||
@Input()
|
||||
nameFile: string;
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if (!this.urlFile) {
|
||||
throw new Error('Attribute urlFile is required');
|
||||
constructor(private contentService: ContentService) {}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let blobFile = changes['blobFile'];
|
||||
if (blobFile && blobFile.currentValue) {
|
||||
this.urlFile = this.contentService.createTrustedUrl(this.blobFile);
|
||||
return;
|
||||
}
|
||||
if (!this.urlFile && !this.blobFile) {
|
||||
throw new Error('Attribute urlFile or blobFile is required');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user