diff --git a/projects/aca-content/src/lib/services/node-actions.service.ts b/projects/aca-content/src/lib/services/node-actions.service.ts index f66b08b78..c185a1d23 100644 --- a/projects/aca-content/src/lib/services/node-actions.service.ts +++ b/projects/aca-content/src/lib/services/node-actions.service.ts @@ -174,6 +174,27 @@ export class NodeActionsService { } getContentNodeSelection(action: NodeAction, contentEntities: NodeEntry[], focusedElementOnCloseSelector?: string): Subject { + this.isSitesDestinationAvailable = false; + const data = this.buildContentNodeSelectorData(action, contentEntities); + + this.dialog + .open(ContentNodeSelectorComponent, { + data, + panelClass: 'adf-content-node-selector-dialog', + width: '630px', + role: 'dialog' + }) + .afterClosed() + .subscribe(() => this.focusAfterClose(focusedElementOnCloseSelector)); + + data.select.subscribe({ + complete: this.close.bind(this) + }); + + return data.select; + } + + protected buildContentNodeSelectorData(action: NodeAction, contentEntities: NodeEntry[]): ContentNodeSelectorComponentData { const currentParentFolderId = this.getEntryParentId(contentEntities[0].entry); const customDropdown = new SitePaging({ @@ -195,12 +216,9 @@ export class NodeActionsService { } as SitePagingList }); - const title = this.getTitleTranslation(action, contentEntities); - - this.isSitesDestinationAvailable = false; - const data: ContentNodeSelectorComponentData = { + return { selectionMode: 'single', - title, + title: this.getTitleTranslation(action, contentEntities), currentFolderId: currentParentFolderId, actionName: action, dropdownHideMyFiles: true, @@ -212,22 +230,6 @@ export class NodeActionsService { select: new Subject(), excludeSiteContent: ContentNodeDialogService.nonDocumentSiteContent }; - - this.dialog - .open(ContentNodeSelectorComponent, { - data, - panelClass: 'adf-content-node-selector-dialog', - width: '630px', - role: 'dialog' - }) - .afterClosed() - .subscribe(() => this.focusAfterClose(focusedElementOnCloseSelector)); - - data.select.subscribe({ - complete: this.close.bind(this) - }); - - return data.select; } getTitleTranslation(action: string, nodes: NodeEntry[] = []): string { @@ -243,7 +245,7 @@ export class NodeActionsService { return this.translation.instant(`NODE_SELECTOR.${action.toUpperCase()}_${keyPrefix}`, { name, number }); } - private canCopyMoveInsideIt(entry: Node): boolean { + protected canCopyMoveInsideIt(entry: Node): boolean { return this.hasEntityCreatePermission(entry) && !this.isSite(entry); } diff --git a/projects/aca-content/src/public-api.ts b/projects/aca-content/src/public-api.ts index da1c1126b..dea029e7a 100644 --- a/projects/aca-content/src/public-api.ts +++ b/projects/aca-content/src/public-api.ts @@ -31,6 +31,7 @@ export * from './lib/aca-content.routes'; export * from './lib/store/initial-state'; export * from './lib/services/content-url.service'; export * from './lib/services/content-management.service'; +export * from './lib/services/node-actions.service'; export * from './lib/components/info-drawer/comments-tab/external-node-permission-comments-tab.service'; export * from './lib/utils/aca-search-utils'; export * from './lib/pipes/is-feature-supported.pipe';