mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user