This commit is contained in:
Shelley Vohr 2017-09-27 14:50:46 -04:00
Родитель 2289d085fa
Коммит 24913a5ef9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F13993A75599653C
3 изменённых файлов: 13 добавлений и 50 удалений

Просмотреть файл

@ -1,4 +1,5 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>Electron</title> <title>Electron</title>
<style> <style>
@ -17,7 +18,7 @@
flex-direction: column; flex-direction: column;
} }
.container > * { .container>* {
margin: 15px 0 0 0; margin: 15px 0 0 0;
} }
@ -57,6 +58,7 @@
.svg-stroke { .svg-stroke {
stroke: #9feaf9; stroke: #9feaf9;
} }
.svg-fill { .svg-fill {
fill: #9feaf9; fill: #9feaf9;
} }
@ -71,7 +73,8 @@
text-decoration: none; text-decoration: none;
} }
pre, code { pre,
code {
font-family: "Menlo", "Lucida Console", monospace; font-family: "Menlo", "Lucida Console", monospace;
border: 1px solid #e0e5e6; border: 1px solid #e0e5e6;
background-color: #f6f8f8; background-color: #f6f8f8;
@ -112,6 +115,7 @@
} }
</style> </style>
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<svg class="header-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> <svg class="header-icon" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
@ -140,34 +144,22 @@
<div class="container"> <div class="container">
<p> <p>
To run your app with Electron, execute the following command in your To run your app with Electron, execute the following command in your Console (or Terminal):
Console (or Terminal):
</p> </p>
<pre class="command-example"></pre> <pre class="command-example"></pre>
<p> <p>
The <code>path-to-your-app</code> should be the path to your own Electron The <code>path-to-your-app</code> should be the path to your own Electron app.
app.
</p> </p>
<p>You can read the <a class="quick-start-link">quick start</a> <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.
guide in Electron's <a class="docs-link">docs</a>
to learn how to write one.
</p> </p>
<p>
Or you can just drag your app here to run it:
</p>
<div id="holder">
Drag your app here to run it
</div>
</div> </div>
<script> <script>
require('./renderer') require('./renderer')
</script> </script>
</body> </body>
</html>
</html>

Просмотреть файл

@ -326,7 +326,7 @@ if (option.file && !option.webdriver) {
process.exit(0) process.exit(0)
} else if (option.default) { } else if (option.default) {
const indexPath = path.join(__dirname, '/index.html') const indexPath = path.join(__dirname, '/index.html')
loadApplicationByUrl(`file://${indexPath}`); loadApplicationByUrl(`file://${indexPath}`)
} else if (option.interactive) { } else if (option.interactive) {
startRepl() startRepl()
} else { } else {

Просмотреть файл

@ -1,9 +1,7 @@
const {remote, shell} = require('electron') const {remote, shell} = require('electron')
const {execFile} = require('child_process')
const {execPath} = remote.process const {execPath} = remote.process
document.onclick = function (e) { document.onclick = (e) => {
e.preventDefault() e.preventDefault()
if (e.target.tagName === 'A') { if (e.target.tagName === 'A') {
shell.openExternal(e.target.href) shell.openExternal(e.target.href)
@ -11,33 +9,6 @@ document.onclick = function (e) {
return false 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 const version = process.versions.electron
document.querySelector('.header-version').innerText = version document.querySelector('.header-version').innerText = version
document.querySelector('.command-example').innerText = `${execPath} path-to-your-app` document.querySelector('.command-example').innerText = `${execPath} path-to-your-app`