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">
<head>
<title>Electron</title>
<style>
@ -17,7 +18,7 @@
flex-direction: column;
}
.container > * {
.container>* {
margin: 15px 0 0 0;
}
@ -57,6 +58,7 @@
.svg-stroke {
stroke: #9feaf9;
}
.svg-fill {
fill: #9feaf9;
}
@ -71,7 +73,8 @@
text-decoration: none;
}
pre, code {
pre,
code {
font-family: "Menlo", "Lucida Console", monospace;
border: 1px solid #e0e5e6;
background-color: #f6f8f8;
@ -112,6 +115,7 @@
}
</style>
</head>
<body>
<div class="header">
<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">
<p>
To run your app with Electron, execute the following command in your
Console (or Terminal):
To run your app with Electron, execute the following command in your Console (or Terminal):
</p>
<pre class="command-example"></pre>
<p>
The <code>path-to-your-app</code> should be the path to your own Electron
app.
The <code>path-to-your-app</code> should be the path to your own Electron app.
</p>
<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.
<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.
</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>
<script>
require('./renderer')
</script>
</body>
</html>
</html>

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

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

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

@ -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`