From 644feaffa422fc92ba73a8d3459da688bf281438 Mon Sep 17 00:00:00 2001
From: Hadi Nategh <hnategh@gmail.com>
Date: Mon, 19 Oct 2020 12:54:16 +0200
Subject: [PATCH] * Filemanager: fix drag and drop a file no longer working
 from outside of browser into the list

---
 api/js/etemplate/et2_widget_file.js     | 3 +++
 api/js/etemplate/et2_widget_file.ts     | 2 ++
 filemanager/templates/default/index.xet | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/api/js/etemplate/et2_widget_file.js b/api/js/etemplate/et2_widget_file.js
index 3d24d78af4..fe403ff0d5 100644
--- a/api/js/etemplate/et2_widget_file.js
+++ b/api/js/etemplate/et2_widget_file.js
@@ -146,6 +146,9 @@ var et2_file = /** @class */ (function (_super) {
             this.input.attr("multiple", "multiple");
         }
         this.setDOMNode(this.node[0]);
+        // set drop target to widget dom node if no target option is specified
+        if (!this.options.drop_target)
+            this.resumable.assignDrop([this.getDOMNode()]);
     };
     /**
      * Get any specific async upload options
diff --git a/api/js/etemplate/et2_widget_file.ts b/api/js/etemplate/et2_widget_file.ts
index 5abc7bbe47..1cfbbb433a 100644
--- a/api/js/etemplate/et2_widget_file.ts
+++ b/api/js/etemplate/et2_widget_file.ts
@@ -237,6 +237,8 @@ export class et2_file extends et2_inputWidget
 		}
 
 		this.setDOMNode(this.node[0]);
+		// set drop target to widget dom node if no target option is specified
+		if (!this.options.drop_target) this.resumable.assignDrop([this.getDOMNode()]);
 	}
 
 	/**
diff --git a/filemanager/templates/default/index.xet b/filemanager/templates/default/index.xet
index 8558d1c102..e6245dba73 100644
--- a/filemanager/templates/default/index.xet
+++ b/filemanager/templates/default/index.xet
@@ -45,7 +45,7 @@
 		</grid>
 	</template>
 	<template id="filemanager.index.header_left" template="" lang="" group="0" version="1.9.002">
-		<file label="Upload" statustext="Select file to upload in current directory" id="upload" progress_dropdownlist = "true" drop_target ="divAppbox" multiple="true" onFinishOne="app.filemanager.uploadOnOne"/>
+		<file label="Upload" statustext="Select file to upload in current directory" id="upload" progress_dropdownlist = "true" drop_target="filemanager-index" multiple="true" onFinishOne="app.filemanager.uploadOnOne"/>
 	</template>
 	<template id="filemanager.index.header_row" template="" lang="" group="0" version="1.9.002">
 		<buttononly id="home" statustext="Go to your home directory" image="gohome" background_image="true" onclick="app.filemanager.change_dir('~',widget);"/>