mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-6620] Proper viewer extension template projection to viewer renderer (#9273)
* [ACS-6620] Proper viewer extension template projection to viewer renderer * [ACS-6620] Use extensions instead of content for viewer config * [ACS-6620] Lint fix
This commit is contained in:
@@ -237,47 +237,48 @@ The Viewer supports dynamically-loaded viewer preview extensions, to know more a
|
||||
|
||||
#### Code extension mechanism]
|
||||
|
||||
You can define your own custom handler to handle other file formats that are not yet supported by
|
||||
You can define your own custom handler to override supported file formats or handle other file formats that are not yet supported by
|
||||
the [Alfresco Viewer component](viewer.component.md). Below is an example that shows how to use the `adf-viewer-extension`
|
||||
to handle 3D data files:
|
||||
|
||||
```html
|
||||
<adf-alfresco-viewer [nodeId]="nodeId">
|
||||
|
||||
<adf-viewer-extension [supportedExtensions]="['obj','3ds']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent" let-extension="extension">
|
||||
<threed-viewer
|
||||
[urlFile]="urlFileContent"
|
||||
[extension]="extension">
|
||||
</threed-viewer>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
|
||||
<ng-template #viewerExtensions>
|
||||
<adf-viewer-extension [supportedExtensions]="['obj','3ds']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent" let-extension="extension">
|
||||
<threed-viewer
|
||||
[urlFile]="urlFileContent"
|
||||
[extension]="extension">
|
||||
</threed-viewer>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
</ng-template>
|
||||
</adf-alfresco-viewer>
|
||||
```
|
||||
|
||||
Note: you need to add the `ng2-3d-editor` dependency to your `package.json` file to make the example above work.
|
||||
|
||||
You can define multiple `adf-viewer-extension` templates if required:
|
||||
You need to keep all instances of `adf-viewer-extension` inside `viewerExtensions` template, also you can define multiple `adf-viewer-extension` templates if required:
|
||||
|
||||
```html
|
||||
<adf-alfresco-viewer [nodeId]="nodeId">
|
||||
<ng-template #viewerExtensions>
|
||||
<adf-viewer-extension [supportedExtensions]="['xls','xlsx']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent">
|
||||
<my-custom-xls-component
|
||||
urlFileContent="urlFileContent">
|
||||
</my-custom-xls-component>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
|
||||
<adf-viewer-extension [supportedExtensions]="['xls','xlsx']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent">
|
||||
<my-custom-xls-component
|
||||
urlFileContent="urlFileContent">
|
||||
</my-custom-xls-component>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
|
||||
<adf-viewer-extension [supportedExtensions]="['txt']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent" >
|
||||
<my-custom-txt-component
|
||||
urlFileContent="urlFileContent">
|
||||
</my-custom-txt-component>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
<adf-viewer-extension [supportedExtensions]="['txt']" #extension>
|
||||
<ng-template let-urlFileContent="urlFileContent" >
|
||||
<my-custom-txt-component
|
||||
urlFileContent="urlFileContent">
|
||||
</my-custom-txt-component>
|
||||
</ng-template>
|
||||
</adf-viewer-extension>
|
||||
</ng-template>
|
||||
</adf-alfresco-viewer>
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user