From d547cd5db8f0cb1306619cc2ab19a378361f9a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 6 Apr 2021 07:52:02 +0200 Subject: [PATCH] Show drop file UI only if dragging a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/structures/RoomView.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index a180afba29..9cebecd944 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1137,10 +1137,11 @@ export default class RoomView extends React.Component { ev.stopPropagation(); ev.preventDefault(); - this.setState({ - dragCounter: this.state.dragCounter + 1, - draggingFile: true, - }); + this.setState({dragCounter: this.state.dragCounter + 1}); + + if (ev.dataTransfer.types.includes("Files") || ev.dataTransfer.types.includes("application/x-moz-file")) { + this.setState({draggingFile: true}); + } }; private onDragLeave = ev => {