diff --git a/app/src/components/Download.js b/app/src/components/Download.js index 93c887a4..19fb7f92 100644 --- a/app/src/components/Download.js +++ b/app/src/components/Download.js @@ -130,6 +130,16 @@ class Downloader extends React.Component { const viewDownloads = View downloads; + const handleDrop = (e) => { + // Handle user dropping multiple URLs into the textarea. Assume each drop is a URL. Ensure each URL + // is on its own line. + e.preventDefault(); + const url = e.dataTransfer.getData('text'); + const separator = (this.state.urls.endsWith('\n') || this.state.urls === '') ? '' : '\n'; + const urls = `${this.state.urls}${separator}${url}\n`; + this.setState({urls: urls}, this.validateUrls); + }; + return {({i}) => (
@@ -140,6 +150,7 @@ class Downloader extends React.Component { onChange={this.handleInputChange} value={this.state.urls} style={{marginBottom: '1em'}} + onDrop={handleDrop} /> {tagsSelector} {pending && }