[ACA-2364] support 'canPreview' rule for the Viewer (#1102)

* support `canPreview` rule for the Viewer

* update plint settings

* update prettier settings for plint

* test fixes

* update config
This commit is contained in:
Denys Vuika
2019-05-10 15:08:00 +01:00
committed by GitHub
parent d5f8699976
commit d8e3b9ada0
6 changed files with 129 additions and 4 deletions

View File

@@ -363,6 +363,7 @@ Viewer component in ACA supports the following extension points:
- Toolbar actions
- `More` toolbar actions
- `Open With` actions
- Rules
```json
{
@@ -547,6 +548,35 @@ and invoke it from the custom `Open With` menu entry called `Snackbar`.
As with other content actions, custom plugins can disable, update or extend `Open With` actions.
### Rules
You can provide global rules for the Viewer by utilizing the `features.viewer.rules` object:
```ts
export interface ViewerRules {
/**
* Checks if user can preview the node.
*/
canPreview?: string;
}
```
For example:
```json
{
"features": {
"viewer": {
"rules": {
"canPreview": "customRule"
}
}
}
}
```
The rule should return `true` if node preview is allowed, otherwise `false`.
## Content metadata presets
The content metadata presets are needed by the [Content Metadata Component](https://www.alfresco.com/abn/adf/docs/content-services/content-metadata-card.component/) to render the properties of metadata aspects for a given node.