| 276 | }); |
| 277 | |
| 278 | const handleDrop = (event: Event, url: string) => { |
| 279 | const protocol = typeof url === 'string' && new URL(url).protocol; |
| 280 | if (protocol === 'file:') { |
| 281 | event.preventDefault(); |
| 282 | const path = fileURLToPath(url); |
| 283 | rpc.emit('session data send', {data: path, escaped: true}); |
| 284 | } else if (protocol === 'http:' || protocol === 'https:') { |
| 285 | event.preventDefault(); |
| 286 | rpc.emit('session data send', {data: url}); |
| 287 | } |
| 288 | }; |
| 289 | |
| 290 | // If file is dropped onto the terminal window, navigate and new-window events are prevented |
| 291 | // and his path is added to active session. |