Skip to content
This repository has been archived by the owner on Sep 14, 2020. It is now read-only.

Commit

Permalink
Merge pull request #16 from stencila/0.27-preview
Browse files Browse the repository at this point in the history
0.27
  • Loading branch information
oliver7654 authored Jul 6, 2017
2 parents 576ad00 + 12dcde6 commit d73df08
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Thumbs.db
*.log
*.autogenerated
# ignore dist folder that has the installers for various platforms
/app
/bundle
/dist
11 changes: 6 additions & 5 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
var b = require('substance-bundler')

function _copyAssets() {
b.copy('./src', './app')
b.copy('./node_modules/stencila/build', './app/lib/stencila')
b.copy('./src', './bundle')
b.copy('./package.json', './bundle/package.json')
b.copy('./node_modules/stencila/build', './bundle/lib/stencila')
}

b.task('clean', () => {
b.rm('app')
b.rm('bundle')
b.rm('dist')
})

b.task('assets', () => {
_copyAssets()
})

b.task('cleanbuild', [ 'clean', 'assets' ])
b.task('default', [ 'assets' ])
b.task('default', [ 'clean', 'assets' ])
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "stencila-desktop",
"productName": "Stencila Desktop",
"productName": "Stencila",
"description": "Stencila for the desktop",
"version": "0.26.0",
"version": "0.27.0",
"author": "Nokome Bentley",
"homepage": "http://stenci.la",
"repository": {
Expand All @@ -13,11 +13,11 @@
"url": "https://github.com/stencila/desktop/issues"
},
"license": "Apache-2.0",
"main": "app/main.js",
"main": "./bundle/main.js",
"build": {
"appId": "com.stencila.stencila-desktop",
"files": [
"app/**/*",
"bundle/**/*",
"node_modules/**/*",
"package.json"
],
Expand All @@ -33,14 +33,14 @@
"start": "node make && npm-run-all --parallel watch app"
},
"dependencies": {
"stencila": "^0.26.3",
"stencila-node": "^0.26.2"
"stencila": "0.27.4",
"stencila-node": "0.27.0"
},
"devDependencies": {
"npm-run-all": "^3.1.0",
"extract-zip": "=1.6.0",
"electron": "1.6.2",
"electron-builder": "^14.5.2",
"electron": "1.6.11",
"electron-builder": "19.13.0",
"source-map-support": "^0.4.11",
"substance-bundler": "^0.15.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<title>Stencila Desktop - Your documents</title>
<link href="./lib/stencila/stencila.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./lib/stencila/lib/substance.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/substance-mini.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/brace.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/d3.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/unified-bundle.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/vega.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/vega-lite.js"></script>
<script type="text/javascript" src="./lib/stencila/katex/katex.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/stencila-mini.js"></script>
<script type="text/javascript" src="./lib/stencila/stencila.js"></script>
<script type="text/javascript" src="./lib/stencila/guides.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion src/document.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<title>Stencila - Edit</title>
<link href="./lib/stencila/stencila.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="./lib/stencila/lib/substance.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/substance-mini.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/brace.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/d3.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/unified-bundle.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/vega.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/vega-lite.js"></script>
<script type="text/javascript" src="./lib/stencila/katex/katex.min.js"></script>
<script type="text/javascript" src="./lib/stencila/lib/stencila-mini.js"></script>
<script type="text/javascript" src="./lib/stencila/stencila.js"></script>
<script>
window.brace = window.ace
Expand Down
8 changes: 4 additions & 4 deletions src/document/DocumentMenuBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { Menu } = require('electron').remote
const macOSAboutMenu = require('../menu/macOSAboutMenu')
const fileMenu = require('../menu/fileMenu')
const editMenu = require('../menu/editMenu')
const annotateMenu = require('../menu/annotateMenu')
const insertMenu = require('../menu/insertMenu')
// const annotateMenu = require('../menu/annotateMenu')
// const insertMenu = require('../menu/insertMenu')
const viewMenu = require('../menu/viewMenu')
const windowMenu = require('../menu/windowMenu')

Expand All @@ -19,8 +19,8 @@ class DocumentMenuBuilder {
}
documentMenu.push(fileMenu(appState))
documentMenu.push(editMenu(appState))
documentMenu.push(annotateMenu(appState))
documentMenu.push(insertMenu(appState))
// documentMenu.push(annotateMenu(appState))
// documentMenu.push(insertMenu(appState))
documentMenu.push(viewMenu(appState))
documentMenu.push(windowMenu(appState))
return Menu.buildFromTemplate(documentMenu)
Expand Down
13 changes: 12 additions & 1 deletion src/document/documentWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,21 @@ _updateMenu(appState)

window.addEventListener('load', () => {
initBackend().then((backend) => {
let host = new Host()
// A new host in the browser window that will discover peers:
// e.g. Stencila Node.js host started in `main.js`
// e.g. Stencila R host started 'manually' locally
// e.g. Stencila Python host started in a docker container
let host = new Host({
// Attempt to discover hosts every x seconds
discover: 30
})
window.host = host

window.backend = backend

let documentId = getQueryStringParam('documentId')
window.documentId = documentId

window.documentPage = DocumentPage.mount({
host,
backend,
Expand Down
6 changes: 6 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ const url = require('url')

const { app, ipcMain, Menu } = electron // eslint-disable-line no-unused-vars

// Run a Stencila Node.js host to provide execution contexts etc
const { host } = require('stencila-node')
host.start()

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
Expand Down Expand Up @@ -47,6 +51,8 @@ app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
// Stop the Stencila Node.js host
host.stop()
})

app.on('activate', function () {
Expand Down
9 changes: 4 additions & 5 deletions src/shared/initBackend.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* window process */
const { FileSystemBackend } = require('stencila-node')
const remote = require('electron').remote
const path = require('path')
const fs = require('fs')
const { app } = remote

const DOCUMENTS_DIR = app.getPath('documents')
const STENCILA_LIBRARY_DIR = path.join(DOCUMENTS_DIR, 'Stencila-0.26.0')
const { FileSystemBackend, host } = require('stencila-node')
const { version } = require('../package.json')

const STENCILA_LIBRARY_DIR = path.join(host.userDir(), `library-${version}`)
const STENCILA_LIBRARY_FILE = path.join(STENCILA_LIBRARY_DIR, 'library.json')
const fileSystemBackend = new FileSystemBackend(STENCILA_LIBRARY_DIR)

Expand Down

0 comments on commit d73df08

Please sign in to comment.