blob: 0722e313089719c15b18bd2ea30db4f9f08e9d62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { Node } from '@nextcloud/files'
import DragAndDropPreview from '../components/DragAndDropPreview.vue'
import Vue from 'vue'
const Preview = Vue.extend(DragAndDropPreview)
let preview: Vue
export const getDragAndDropPreview = async (nodes: Node[]): Promise<Element> => {
return new Promise((resolve) => {
if (!preview) {
preview = new Preview().$mount()
document.body.appendChild(preview.$el)
}
preview.update(nodes)
preview.$on('loaded', () => {
resolve(preview.$el)
preview.$off('loaded')
})
})
}
|