diff options
Diffstat (limited to 'apps/files/src/store/dragging.ts')
-rw-r--r-- | apps/files/src/store/dragging.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/files/src/store/dragging.ts b/apps/files/src/store/dragging.ts new file mode 100644 index 00000000000..810f662149c --- /dev/null +++ b/apps/files/src/store/dragging.ts @@ -0,0 +1,31 @@ +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +import type { DragAndDropStore, FileSource } from '../types' + +import { defineStore } from 'pinia' +import Vue from 'vue' + +export const useDragAndDropStore = defineStore('dragging', { + state: () => ({ + dragging: [], + } as DragAndDropStore), + + actions: { + /** + * Set the selection of files being dragged currently + * @param selection array of node sources + */ + set(selection = [] as FileSource[]) { + Vue.set(this, 'dragging', selection) + }, + + /** + * Reset the selection + */ + reset() { + Vue.set(this, 'dragging', []) + }, + }, +}) |