summaryrefslogtreecommitdiff
path: root/src/client/app/desktop/api/choose-drive-file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/app/desktop/api/choose-drive-file.ts')
-rw-r--r--src/client/app/desktop/api/choose-drive-file.ts30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client/app/desktop/api/choose-drive-file.ts b/src/client/app/desktop/api/choose-drive-file.ts
new file mode 100644
index 0000000000..fbda600e6e
--- /dev/null
+++ b/src/client/app/desktop/api/choose-drive-file.ts
@@ -0,0 +1,30 @@
+import { url } from '../../config';
+import MkChooseFileFromDriveWindow from '../views/components/choose-file-from-drive-window.vue';
+
+export default function(opts) {
+ return new Promise((res, rej) => {
+ const o = opts || {};
+
+ if (document.body.clientWidth > 800) {
+ const w = new MkChooseFileFromDriveWindow({
+ propsData: {
+ title: o.title,
+ multiple: o.multiple,
+ initFolder: o.currentFolder
+ }
+ }).$mount();
+ w.$once('selected', file => {
+ res(file);
+ });
+ document.body.appendChild(w.$el);
+ } else {
+ window['cb'] = file => {
+ res(file);
+ };
+
+ window.open(url + '/selectdrive',
+ 'choose_drive_window',
+ 'height=500, width=800');
+ }
+ });
+}