diff --git a/scripts/core/ui/components/drop-zone-3.tsx b/scripts/core/ui/components/drop-zone-3.tsx index 49b4979ebc..b3f3e6d541 100644 --- a/scripts/core/ui/components/drop-zone-3.tsx +++ b/scripts/core/ui/components/drop-zone-3.tsx @@ -19,29 +19,23 @@ interface IState { } export class DropZone3 extends React.PureComponent { - private elem: React.RefObject; private input: React.RefObject; constructor(props) { super(props); - this.elem = React.createRef(); this.input = React.createRef(); - this.onDragStart = this.onDragStart.bind(this); this.onDragEnd = this.onDragEnd.bind(this); this.onDrop = this.onDrop.bind(this); this.onDropOver = this.onDropOver.bind(this); + this.onDragLeave = this.onDragLeave.bind(this); this.state = { dragging: false, }; } - onDragStart() { - this.setState({dragging: true}); - } - onDragEnd() { this.setState({dragging: false}); } @@ -53,25 +47,18 @@ export class DropZone3 extends React.PureComponent { + e.preventDefault(); + + if (this.state.dragging != true) { + this.setState({dragging: true}); + } + }} + onDragLeave={(e) => { + e.preventDefault(); + this.setState({dragging: false}); + }} + onDragEnd={this.onDragEnd} + onDrop={this.onDrop} className={this.props.className} - ref={this.elem} style={styles} > {