fix link behavior
This commit is contained in:
parent
56581b416d
commit
bf2b6b3ac4
1 changed files with 7 additions and 7 deletions
|
@ -2,13 +2,13 @@ const {remote, shell} = require('electron')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const electronPath = path.relative(process.cwd(), remote.process.execPath)
|
const electronPath = path.relative(process.cwd(), remote.process.execPath)
|
||||||
|
|
||||||
document.onclick = (e) => {
|
Array.from(document.querySelectorAll('a[href]')).forEach(link => {
|
||||||
e.preventDefault()
|
const url = link.getAttribute('href')
|
||||||
if (e.target.tagName === 'A') {
|
link.addEventListener('click', (e) => {
|
||||||
shell.openExternal(e.target.href)
|
e.preventDefault()
|
||||||
}
|
shell.openExternal(url)
|
||||||
return false
|
})
|
||||||
}
|
})
|
||||||
|
|
||||||
document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}`
|
document.querySelector('.electron-version').innerText = `Electron v${process.versions.electron}`
|
||||||
document.querySelector('.chrome-version').innerText = `Chromium v${process.versions.chrome}`
|
document.querySelector('.chrome-version').innerText = `Chromium v${process.versions.chrome}`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue