From 9d9eaec14f4e4a8bc3bda4ef19c980bef2bb467b Mon Sep 17 00:00:00 2001
From: Reed Garmsen <rgarmsen2295@gmail.com>
Date: Wed, 6 Jan 2016 14:18:05 -0800
Subject: Removed ability to drag n' drop text; drag n' drop ui no longer
 appears when non-files are dragged

---
 web/react/components/file_upload.jsx | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

(limited to 'web/react/components/file_upload.jsx')

diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx
index 9316ca9a5..8c7353e86 100644
--- a/web/react/components/file_upload.jsx
+++ b/web/react/components/file_upload.jsx
@@ -109,8 +109,6 @@ export default class FileUpload extends React.Component {
 
         if (typeof files !== 'string' && files.length) {
             this.uploadFiles(files);
-        } else {
-            this.props.onTextDrop(e.originalEvent.dataTransfer.getData('Text'));
         }
     }
 
@@ -120,11 +118,19 @@ export default class FileUpload extends React.Component {
 
         if (this.props.postType === 'post') {
             $('.row.main').dragster({
-                enter() {
-                    $('.center-file-overlay').removeClass('hidden');
+                enter(dragsterEvent, e) {
+                    var files = e.originalEvent.dataTransfer;
+
+                    if (utils.isFileTransfer(files)) {
+                        $('.center-file-overlay').removeClass('hidden');
+                    }
                 },
-                leave() {
-                    $('.center-file-overlay').addClass('hidden');
+                leave(dragsterEvent, e) {
+                    var files = e.originalEvent.dataTransfer;
+
+                    if (utils.isFileTransfer(files)) {
+                        $('.center-file-overlay').addClass('hidden');
+                    }
                 },
                 drop(dragsterEvent, e) {
                     $('.center-file-overlay').addClass('hidden');
@@ -133,11 +139,19 @@ export default class FileUpload extends React.Component {
             });
         } else if (this.props.postType === 'comment') {
             $('.post-right__container').dragster({
-                enter() {
-                    $('.right-file-overlay').removeClass('hidden');
+                enter(dragsterEvent, e) {
+                    var files = e.originalEvent.dataTransfer;
+
+                    if (utils.isFileTransfer(files)) {
+                        $('.right-file-overlay').removeClass('hidden');
+                    }
                 },
-                leave() {
-                    $('.right-file-overlay').addClass('hidden');
+                leave(dragsterEvent, e) {
+                    var files = e.originalEvent.dataTransfer;
+
+                    if (utils.isFileTransfer(files)) {
+                        $('.right-file-overlay').addClass('hidden');
+                    }
                 },
                 drop(dragsterEvent, e) {
                     $('.right-file-overlay').addClass('hidden');
-- 
cgit v1.2.3-1-g7c22

