Skip to content

Commit 24913a5

Browse files
committed
remove drag functions
1 parent 2289d08 commit 24913a5

File tree

3 files changed

+13
-50
lines changed

3 files changed

+13
-50
lines changed

default_app/index.html

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<html lang="en">
2+
23
<head>
34
<title>Electron</title>
45
<style>
@@ -17,7 +18,7 @@
1718
flex-direction: column;
1819
}
1920

20-
.container > * {
21+
.container>* {
2122
margin: 15px 0 0 0;
2223
}
2324

@@ -57,6 +58,7 @@
5758
.svg-stroke {
5859
stroke: #9feaf9;
5960
}
61+
6062
.svg-fill {
6163
fill: #9feaf9;
6264
}
@@ -71,7 +73,8 @@
7173
text-decoration: none;
7274
}
7375

74-
pre, code {
76+
pre,
77+
code {
7578
font-family: "Menlo", "Lucida Console", monospace;
7679
border: 1px solid #e0e5e6;
7780
background-color: #f6f8f8;
@@ -112,6 +115,7 @@
112115
}
113116
</style>
114117
</head>
118+
115119
<body>
116120
<div class="header">
117121
<svg class="header-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
@@ -140,34 +144,22 @@
140144
<div class="container">
141145

142146
<p>
143-
To run your app with Electron, execute the following command in your
144-
Console (or Terminal):
147+
To run your app with Electron, execute the following command in your Console (or Terminal):
145148
</p>
146149

147150
<pre class="command-example"></pre>
148151

149152
<p>
150-
The <code>path-to-your-app</code> should be the path to your own Electron
151-
app.
153+
The <code>path-to-your-app</code> should be the path to your own Electron app.
152154
</p>
153155

154-
<p>You can read the <a class="quick-start-link">quick start</a>
155-
guide in Electron's <a class="docs-link">docs</a>
156-
to learn how to write one.
156+
<p>You can read the <a class="quick-start-link">quick start</a> guide in Electron's <a class="docs-link">docs</a> to learn how to write one.
157157
</p>
158-
159-
<p>
160-
Or you can just drag your app here to run it:
161-
</p>
162-
163-
<div id="holder">
164-
Drag your app here to run it
165-
</div>
166-
167158
</div>
168159

169160
<script>
170161
require('./renderer')
171162
</script>
172163
</body>
173-
</html>
164+
165+
</html>

default_app/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ if (option.file && !option.webdriver) {
326326
process.exit(0)
327327
} else if (option.default) {
328328
const indexPath = path.join(__dirname, '/index.html')
329-
loadApplicationByUrl(`file://${indexPath}`);
329+
loadApplicationByUrl(`file://${indexPath}`)
330330
} else if (option.interactive) {
331331
startRepl()
332332
} else {

default_app/renderer.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,14 @@
11
const {remote, shell} = require('electron')
2-
const {execFile} = require('child_process')
3-
42
const {execPath} = remote.process
53

6-
document.onclick = function (e) {
4+
document.onclick = (e) => {
75
e.preventDefault()
86
if (e.target.tagName === 'A') {
97
shell.openExternal(e.target.href)
108
}
119
return false
1210
}
1311

14-
document.ondragover = document.ondrop = function (e) {
15-
e.preventDefault()
16-
return false
17-
}
18-
19-
const holder = document.getElementById('holder')
20-
holder.ondragover = function () {
21-
this.className = 'hover'
22-
return false
23-
}
24-
25-
holder.ondragleave = holder.ondragend = function () {
26-
this.className = ''
27-
return false
28-
}
29-
30-
holder.ondrop = function (e) {
31-
this.className = ''
32-
e.preventDefault()
33-
34-
const file = e.dataTransfer.files[0]
35-
execFile(execPath, [file.path], {
36-
detached: true, stdio: 'ignore'
37-
}).unref()
38-
return false
39-
}
40-
4112
const version = process.versions.electron
4213
document.querySelector('.header-version').innerText = version
4314
document.querySelector('.command-example').innerText = `${execPath} path-to-your-app`

0 commit comments

Comments
 (0)