diff --git a/src/Umbraco.Web.UI.Client/libs/store/store.ts b/src/Umbraco.Web.UI.Client/libs/store/store.ts index e87dab36d7..083cc9fc2f 100644 --- a/src/Umbraco.Web.UI.Client/libs/store/store.ts +++ b/src/Umbraco.Web.UI.Client/libs/store/store.ts @@ -18,11 +18,20 @@ export interface UmbTreeStore extends UmbDataStore { // Notice: this might not be right to put here as only some content items has ability to be trashed. /** * @description - Trash data. - * @param {object} data + * @param {string[]} keys * @return {*} {(Promise)} - * @memberof UmbContentStore + * @memberof UmbTreeStore */ trash(keys: string[]): Promise; + + // Notice: this might not be right to put here as only some content items has ability to be moved. + /** + * @description - Move data. + * @param {string[]} keys + * @return {*} {(Promise)} + * @memberof UmbTreeStore + */ + move(keys: string[], destination: string): Promise; } export interface UmbEntityDetailStore extends UmbDataStore { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-move.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-move.element.ts index b118d19dde..3367c5d691 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-move.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/bulk-actions/collection-bulk-action-media-move.element.ts @@ -4,7 +4,6 @@ import { customElement } from 'lit/decorators.js'; import { ifDefined } from 'lit/directives/if-defined.js'; import { UmbCollectionContext, UMB_COLLECTION_CONTEXT_TOKEN } from '../collection.context'; import { UmbModalService, UMB_MODAL_SERVICE_CONTEXT_TOKEN } from '../../../../core/modal'; -import { UmbMediaTreeStore, UMB_MEDIA_TREE_STORE_CONTEXT_TOKEN } from '../../../media/media/media.tree.store'; import { UmbLitElement } from '@umbraco-cms/element'; import type { ManifestCollectionBulkAction } from '@umbraco-cms/models'; @@ -18,7 +17,6 @@ export class UmbCollectionBulkActionMoveElement extends UmbLitElement { public manifest?: ManifestCollectionBulkAction; #modalService?: UmbModalService; - #mediaTreeStore?: UmbMediaTreeStore; constructor() { super(); @@ -31,9 +29,6 @@ export class UmbCollectionBulkActionMoveElement extends UmbLitElement { this.#modalService = instance; }); - this.consumeContext(UMB_MEDIA_TREE_STORE_CONTEXT_TOKEN, (instance) => { - this.#mediaTreeStore = instance; - }); } #handleClick() { @@ -44,7 +39,7 @@ export class UmbCollectionBulkActionMoveElement extends UmbLitElement { }); modalHandler?.onClose().then((data) => { if (selection.length > 0) { - this.#mediaTreeStore?.move(selection, data.selection[0]); + this.#collectionContext?.move(selection, data.selection[0]); } selectionSubscription?.unsubscribe(); this.#collectionContext?.clearSelection(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts index d2c6358214..ed0477d569 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/collection/collection.context.ts @@ -93,10 +93,15 @@ export class UmbCollectionContext< } // TODO: Not all can trash, so maybe we need to differentiate on collection contexts or fix it with another architecture. - public trash(keys:string[]) { + public trash(keys: string[]) { this._store?.trash(keys); } + // TODO: Not all can move, so maybe we need to differentiate on collection contexts or fix it with another architecture. + public move(keys: string[], destination: string) { + this._store?.move(keys, destination); + } + public clearSelection() { this.#selection.next([]); }