On paste: Do not handle multiple newline separated torrent ids
If the user accidentally pastes something that's not a torrent id, then they get one "Invalid torrent Id" error for each line of the text. Sure, this removes a "feature", but it's a pretty surprising one. When I added it, I was being too clever, IMO. The trim code can be removed, because that's handled in controllers.torrentList.addTorrent().
This commit is contained in:
@@ -428,14 +428,7 @@ function onError (err) {
|
||||
|
||||
function onPaste (e) {
|
||||
if (e.target.tagName.toLowerCase() === 'input') return
|
||||
|
||||
const torrentIds = electron.clipboard.readText().split('\n')
|
||||
torrentIds.forEach(function (torrentId) {
|
||||
torrentId = torrentId.trim()
|
||||
if (torrentId.length === 0) return
|
||||
controllers.torrentList.addTorrent(torrentId)
|
||||
})
|
||||
|
||||
controllers.torrentList.addTorrent(electron.clipboard.readText())
|
||||
update()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user