feat: paste torrent address with right click (#1989)

* feat: paste torrent address with right click

* Change right click to directly pasting
This commit is contained in:
Alex
2021-06-09 23:55:40 +02:00
committed by GitHub
parent d12fd7768a
commit ef4fc2d28d
3 changed files with 11 additions and 2 deletions

View File

@@ -255,6 +255,7 @@ const dispatchHandlers = {
controllers.torrentList().confirmDeleteTorrent(infoHash, deleteData),
deleteTorrent: (infoHash, deleteData) =>
controllers.torrentList().deleteTorrent(infoHash, deleteData),
openTorrentListContextMenu: () => onPaste(),
confirmDeleteAllTorrents: (deleteData) =>
controllers.torrentList().confirmDeleteAllTorrents(deleteData),
deleteAllTorrents: (deleteData) =>
@@ -519,7 +520,7 @@ function onError (err) {
const editableHtmlTags = new Set(['input', 'textarea'])
function onPaste (e) {
if (editableHtmlTags.has(e.target.tagName.toLowerCase())) return
if (e && editableHtmlTags.has(e.target.tagName.toLowerCase())) return
controllers.torrentList().addTorrent(electron.clipboard.readText())
update()

View File

@@ -35,7 +35,11 @@ module.exports = class TorrentList extends React.Component {
)
return (
<div key='torrent-list' className='torrent-list'>
<div
key='torrent-list'
className='torrent-list'
onContextMenu={dispatcher('openTorrentListContextMenu')}
>
{contents}
</div>
)

View File

@@ -322,6 +322,10 @@ textarea,
* TORRENT LIST
*/
.torrent-list {
height: 100%;
}
.torrent {
background: linear-gradient(to bottom right, #4B79A1, #283E51);
background-repeat: no-repeat;