From 014acbab1f6bf3553b80ad140924399bcf7b696d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Mon, 15 Feb 2016 21:16:04 +0200 Subject: [PATCH] restore drag & drop file upload, broken by @richvdh's new timeline stuff --- src/components/structures/RoomView.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 842f59700b..25c289ba96 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -552,14 +552,6 @@ module.exports = React.createClass({ window.addEventListener('resize', this.onResize); this.onResize(); - if (this.refs.roomView) { - var roomView = ReactDOM.findDOMNode(this.refs.roomView); - roomView.addEventListener('drop', this.onDrop); - roomView.addEventListener('dragover', this.onDragOver); - roomView.addEventListener('dragleave', this.onDragLeaveOrEnd); - roomView.addEventListener('dragend', this.onDragLeaveOrEnd); - } - this._updateTabCompleteList(); // XXX: EVIL HACK to autofocus inviting on empty rooms. @@ -597,6 +589,16 @@ module.exports = React.createClass({ // separate component to avoid this ridiculous dance. if (!this.refs.messagePanel) return; + if (this.refs.roomView) { + var roomView = ReactDOM.findDOMNode(this.refs.roomView); + if (!roomView.ondrop) { + roomView.addEventListener('drop', this.onDrop); + roomView.addEventListener('dragover', this.onDragOver); + roomView.addEventListener('dragleave', this.onDragLeaveOrEnd); + roomView.addEventListener('dragend', this.onDragLeaveOrEnd); + } + } + if (!this.refs.messagePanel.initialised) { this._initialiseMessagePanel(); }