mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
support "disabled" rules for Viewer extensions
This commit is contained in:
@@ -153,10 +153,11 @@ export class AppExtensionService implements AppRuleContext {
|
||||
config,
|
||||
'features.viewer.shared.toolbarActions'
|
||||
);
|
||||
this.viewerContentExtensions = this.loader.getElements<ViewerExtensionRef>(
|
||||
config,
|
||||
'features.viewer.content'
|
||||
);
|
||||
|
||||
this.viewerContentExtensions = this.loader
|
||||
.getElements<ViewerExtensionRef>(config, 'features.viewer.content')
|
||||
.filter(ref => !this.isViewerExtensionDisabled(ref));
|
||||
|
||||
this.contextMenuActions = this.loader.getContentActions(
|
||||
config,
|
||||
'features.contextMenu'
|
||||
@@ -457,6 +458,20 @@ export class AppExtensionService implements AppRuleContext {
|
||||
return true;
|
||||
}
|
||||
|
||||
isViewerExtensionDisabled(extension: any): boolean {
|
||||
if (extension) {
|
||||
if (extension.disabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (extension.rules && extension.rules.disabled) {
|
||||
return this.extensions.evaluateRule(extension.rules.disabled, this);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
runActionById(id: string) {
|
||||
const action = this.extensions.getActionById(id);
|
||||
if (action) {
|
||||
|
Reference in New Issue
Block a user