Supports dynamically-loaded viewer preview extensions.
See the ACA monaco extension for an example of a real working viewer extension project.
| Name | Type | Default value | Description |
|---|---|---|---|
| extension | string | File extension (.jpg, .png, etc) for the viewer. | |
| id | string | ID string of the component to preview. | |
| url | string | URL of the content in the repository. |
To create your custom extension viewer you need to create the following files in a separate project:
The Module needs to declare the ID of your extension:
export class YourExtensionViewerModule {
constructor(extensions: ExtensionService) {
extensions.setComponents({
'your-extension.main.component': YourExtensionViewerComponent
});
}
}
Your viewer component extension contains the business logic:
import { Node } from '@alfresco/js-api'; import { ViewerExtensionInterface } from '@alfresco/adf-extensions'; @Component({ selector: 'your-extension-viewer', templateUrl: './your-extension-view.component.html', styleUrls: ['./your-extension-view.component.css'], encapsulation: ViewEncapsulation.None }) class YourExtensionViewerComponent implements ViewerExtensionInterface { showToolbar = true; @Input() url: string; @Input() node: Node; ....YOUR CUSTOM LOGIC }
The viewer component
also needs an HTML template (which is referenced by the templateUrl property
in the @Component decorator of the component class above):
<div> This is your custom extension viewer template</div>
You also need to provide a viewer componentextension.json file containing its details:
{
"$version": "1.0.0",
"$name": "my viewer extension",
"$description": "my viewer plugin",
"features": {
"viewer": {
"content": [
{
"id": "dev.tools.viewer.viewer",
"fileExtension": ["png", "jpg"],
"component": "your-extension.main.component"
}
]
}
}
}
You can also use * wildcard to register a single component that opens all files:
{
"$version": "1.0.0",
"$name": "my viewer extension",
"$description": "my viewer plugin",
"features": {
"viewer": {
"content": [
{
"id": "dev.tools.viewer.viewer",
"fileExtension": "*",
"component": "your-extension.main.component"
}
]
}
}
}
It is recommended to use wildcard replacement only when introducing your own Viewer implementation.
See the App extensions page for further details of how to develop extensions.
© 2023 Alfresco Software, Inc. All Rights Reserved.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.