restore drag & drop file upload, broken by @richvdh's new timeline stuff

This commit is contained in:
Matthew Hodgson 2016-02-15 21:16:04 +02:00
parent b1a6575b1d
commit 014acbab1f

View file

@ -552,14 +552,6 @@ module.exports = React.createClass({
window.addEventListener('resize', this.onResize); window.addEventListener('resize', this.onResize);
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(); this._updateTabCompleteList();
// XXX: EVIL HACK to autofocus inviting on empty rooms. // XXX: EVIL HACK to autofocus inviting on empty rooms.
@ -597,6 +589,16 @@ module.exports = React.createClass({
// separate component to avoid this ridiculous dance. // separate component to avoid this ridiculous dance.
if (!this.refs.messagePanel) return; 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) { if (!this.refs.messagePanel.initialised) {
this._initialiseMessagePanel(); this._initialiseMessagePanel();
} }