Skip to content

Commit

Permalink
feat: paste torrent address with right click (#1989)
Browse files Browse the repository at this point in the history
* feat: paste torrent address with right click

* Change right click to directly pasting
  • Loading branch information
alxhotel committed Jun 9, 2021
1 parent d12fd77 commit ef4fc2d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/renderer/main.js
Expand Up @@ -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) =>
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/pages/torrent-list-page.js
Expand Up @@ -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>
)
Expand Down
4 changes: 4 additions & 0 deletions static/main.css
Expand Up @@ -322,6 +322,10 @@ textarea,
* TORRENT LIST
*/

.torrent-list {
height: 100%;
}

.torrent {
background: linear-gradient(to bottom right, #4B79A1, #283E51);
background-repeat: no-repeat;
Expand Down

0 comments on commit ef4fc2d

Please sign in to comment.