b14b876d50
* refactor: replace Array.prototype.forEach.call with plain for-of * fix: add missing contextIsolation: false * fix: open links in default browser
21 lines
545 B
JavaScript
21 lines
545 B
JavaScript
const { ipcRenderer } = require('electron')
|
|
const shell = require('electron').shell
|
|
|
|
const links = document.querySelectorAll('a[href]')
|
|
|
|
for (const link of links) {
|
|
const url = link.getAttribute('href')
|
|
if (url.indexOf('http') === 0) {
|
|
link.addEventListener('click', (e) => {
|
|
e.preventDefault()
|
|
shell.openExternal(url)
|
|
})
|
|
}
|
|
}
|
|
|
|
const dragFileLink = document.getElementById('drag-file-link')
|
|
|
|
dragFileLink.addEventListener('dragstart', event => {
|
|
event.preventDefault()
|
|
ipcRenderer.send('ondragstart', __filename)
|
|
})
|