remove drag functions
This commit is contained in:
parent
2289d085fa
commit
24913a5ef9
3 changed files with 13 additions and 50 deletions
|
@ -1,9 +1,7 @@
|
|||
const {remote, shell} = require('electron')
|
||||
const {execFile} = require('child_process')
|
||||
|
||||
const {execPath} = remote.process
|
||||
|
||||
document.onclick = function (e) {
|
||||
document.onclick = (e) => {
|
||||
e.preventDefault()
|
||||
if (e.target.tagName === 'A') {
|
||||
shell.openExternal(e.target.href)
|
||||
|
@ -11,33 +9,6 @@ document.onclick = function (e) {
|
|||
return false
|
||||
}
|
||||
|
||||
document.ondragover = document.ondrop = function (e) {
|
||||
e.preventDefault()
|
||||
return false
|
||||
}
|
||||
|
||||
const holder = document.getElementById('holder')
|
||||
holder.ondragover = function () {
|
||||
this.className = 'hover'
|
||||
return false
|
||||
}
|
||||
|
||||
holder.ondragleave = holder.ondragend = function () {
|
||||
this.className = ''
|
||||
return false
|
||||
}
|
||||
|
||||
holder.ondrop = function (e) {
|
||||
this.className = ''
|
||||
e.preventDefault()
|
||||
|
||||
const file = e.dataTransfer.files[0]
|
||||
execFile(execPath, [file.path], {
|
||||
detached: true, stdio: 'ignore'
|
||||
}).unref()
|
||||
return false
|
||||
}
|
||||
|
||||
const version = process.versions.electron
|
||||
document.querySelector('.header-version').innerText = version
|
||||
document.querySelector('.command-example').innerText = `${execPath} path-to-your-app`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue