mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 10:46:32 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78a095d958 | ||
|
|
627172f6df | ||
|
|
a39f25961c | ||
|
|
e738ae5c8c | ||
|
|
749e85e8e6 | ||
|
|
cfa251b158 | ||
|
|
1ca38b8741 | ||
|
|
d7bc5a7088 | ||
|
|
3b9a2c3ee1 | ||
|
|
260ad77d39 | ||
|
|
5c508a0cd9 | ||
|
|
fd3d1607a4 | ||
|
|
abbc0fbcf1 | ||
|
|
00be41608d | ||
|
|
499c3f2e13 | ||
|
|
627845f6e4 | ||
|
|
07eea76057 | ||
|
|
fecc4e9b79 | ||
|
|
58e9302f15 | ||
|
|
86f649fab1 | ||
|
|
9ac0becfb2 | ||
|
|
eda547b868 | ||
|
|
07291d71f2 | ||
|
|
d1ca1ec4d9 | ||
|
|
6a4e8c95ea | ||
|
|
2f90890f50 |
@@ -125,6 +125,12 @@ export default class ArticleEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMouseUp (e) {
|
handleMouseUp (e) {
|
||||||
|
let { article } = this.props
|
||||||
|
let showPreview = article.mode === 'markdown' && this.state.status === PREVIEW_MODE
|
||||||
|
if (!showPreview) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
switch (this.state.switchPreview) {
|
switch (this.state.switchPreview) {
|
||||||
case 'blur':
|
case 'blur':
|
||||||
switch (e.button) {
|
switch (e.button) {
|
||||||
@@ -144,6 +150,12 @@ export default class ArticleEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMouseMove (e) {
|
handleMouseMove (e) {
|
||||||
|
let { article } = this.props
|
||||||
|
let showPreview = article.mode === 'markdown' && this.state.status === PREVIEW_MODE
|
||||||
|
if (!showPreview) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state.switchPreview === 'blur' && this.isMouseDown) {
|
if (this.state.switchPreview === 'blur' && this.isMouseDown) {
|
||||||
this.moveCount++
|
this.moveCount++
|
||||||
if (this.moveCount > 5) {
|
if (this.moveCount > 5) {
|
||||||
@@ -153,6 +165,12 @@ export default class ArticleEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleMouseDowm (e) {
|
handleMouseDowm (e) {
|
||||||
|
let { article } = this.props
|
||||||
|
let showPreview = article.mode === 'markdown' && this.state.status === PREVIEW_MODE
|
||||||
|
if (!showPreview) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
switch (this.state.switchPreview) {
|
switch (this.state.switchPreview) {
|
||||||
case 'blur':
|
case 'blur':
|
||||||
switch (e.button) {
|
switch (e.button) {
|
||||||
|
|||||||
@@ -231,8 +231,8 @@ export default class ArticleTopBar extends React.Component {
|
|||||||
<ExternalLink className='ArticleTopBar-right-links-button-dropdown-item' href='https://b00st.io'>
|
<ExternalLink className='ArticleTopBar-right-links-button-dropdown-item' href='https://b00st.io'>
|
||||||
<i className='fa fa-fw fa-home'/>Boost official page
|
<i className='fa fa-fw fa-home'/>Boost official page
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
<ExternalLink className='ArticleTopBar-right-links-button-dropdown-item' href='https://github.com/BoostIO/boost-app-discussions/issues'>
|
<ExternalLink className='ArticleTopBar-right-links-button-dropdown-item' href='https://github.com/BoostIO/Boostnote/issues'>
|
||||||
<i className='fa fa-fw fa-bullhorn'/> Discuss
|
<i className='fa fa-fw fa-github'/> Issues
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react'
|
|||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
require('../styles/main/index.styl')
|
require('../styles/main/index.styl')
|
||||||
import { openModal } from 'browser/lib/modal'
|
import { openModal } from 'browser/lib/modal'
|
||||||
import Tutorial from './modal/Tutorial'
|
import OSSAnnounceModal from './modal/OSSAnnounceModal'
|
||||||
import activityRecord from 'browser/lib/activityRecord'
|
import activityRecord from 'browser/lib/activityRecord'
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const ipc = electron.ipcRenderer
|
const ipc = electron.ipcRenderer
|
||||||
@@ -25,6 +25,15 @@ window.addEventListener('online', function () {
|
|||||||
ipc.send('check-update', 'check-update')
|
ipc.send('check-update', 'check-update')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
document.addEventListener('drop', function (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
})
|
||||||
|
document.addEventListener('dragover', function (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
|
})
|
||||||
|
|
||||||
function notify (title, options) {
|
function notify (title, options) {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
options.icon = path.join('file://', global.__dirname, '../../resources/app.png')
|
options.icon = path.join('file://', global.__dirname, '../../resources/app.png')
|
||||||
@@ -59,9 +68,10 @@ ReactDOM.render((
|
|||||||
loadingCover.parentNode.removeChild(loadingCover)
|
loadingCover.parentNode.removeChild(loadingCover)
|
||||||
let status = JSON.parse(localStorage.getItem('status'))
|
let status = JSON.parse(localStorage.getItem('status'))
|
||||||
if (status == null) status = {}
|
if (status == null) status = {}
|
||||||
if (!status.introWatched) {
|
|
||||||
openModal(Tutorial)
|
if (!status.ossAnnounceWatched) {
|
||||||
status.introWatched = true
|
openModal(OSSAnnounceModal)
|
||||||
|
status.ossAnnounceWatched = true
|
||||||
localStorage.setItem('status', JSON.stringify(status))
|
localStorage.setItem('status', JSON.stringify(status))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
29
browser/main/modal/OSSAnnounceModal.js
Normal file
29
browser/main/modal/OSSAnnounceModal.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import React, { PropTypes } from 'react'
|
||||||
|
import ExternalLink from 'browser/components/ExternalLink'
|
||||||
|
|
||||||
|
export default class OSSAnnounceModal extends React.Component {
|
||||||
|
handleCloseBtnClick (e) {
|
||||||
|
this.props.close()
|
||||||
|
}
|
||||||
|
render () {
|
||||||
|
return (
|
||||||
|
<div className='OSSAnnounceModal modal'>
|
||||||
|
|
||||||
|
<div className='OSSAnnounceModal-title'>Boostnote has been Open-sourced</div>
|
||||||
|
|
||||||
|
<ExternalLink className='OSSAnnounceModal-link' href='https://github.com/BoostIO/Boostnote'>
|
||||||
|
https://github.com/BoostIO/Boostnote
|
||||||
|
</ExternalLink>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className='OSSAnnounceModal-closeBtn'
|
||||||
|
onClick={(e) => this.handleCloseBtnClick(e)}
|
||||||
|
>Close</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OSSAnnounceModal.propTypes = {
|
||||||
|
close: PropTypes.func
|
||||||
|
}
|
||||||
@@ -1,122 +1,23 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import clientKey from 'browser/lib/clientKey'
|
|
||||||
import linkState from 'browser/lib/linkState'
|
import linkState from 'browser/lib/linkState'
|
||||||
import _ from 'lodash'
|
import ExternalLink from 'browser/components/ExternalLink'
|
||||||
import { request, SERVER_URL } from 'browser/lib/api'
|
|
||||||
|
|
||||||
const FORM_MODE = 'FORM_MODE'
|
|
||||||
const DONE_MODE = 'DONE_MODE'
|
|
||||||
|
|
||||||
export default class ContactTab extends React.Component {
|
export default class ContactTab extends React.Component {
|
||||||
constructor (props) {
|
|
||||||
super(props)
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
title: '',
|
|
||||||
content: '',
|
|
||||||
email: '',
|
|
||||||
mode: FORM_MODE,
|
|
||||||
alert: null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
let titleInput = ReactDOM.findDOMNode(this.refs.title)
|
let titleInput = ReactDOM.findDOMNode(this.refs.title)
|
||||||
if (titleInput != null) titleInput.focus()
|
if (titleInput != null) titleInput.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBackButtonClick (e) {
|
|
||||||
this.setState({
|
|
||||||
mode: FORM_MODE
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSendButtonClick (e) {
|
|
||||||
let input = _.pick(this.state, ['title', 'content', 'email'])
|
|
||||||
input.clientKey = clientKey.get()
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
alert: {
|
|
||||||
type: 'info',
|
|
||||||
message: 'Sending...'
|
|
||||||
}
|
|
||||||
}, () => {
|
|
||||||
request.post(SERVER_URL + 'apis/inquiry')
|
|
||||||
.send(input)
|
|
||||||
.then(res => {
|
|
||||||
console.log('sent')
|
|
||||||
this.setState({
|
|
||||||
title: '',
|
|
||||||
content: '',
|
|
||||||
mode: DONE_MODE,
|
|
||||||
alert: null
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
if (err.code === 'ECONNREFUSED') {
|
|
||||||
this.setState({
|
|
||||||
alert: {
|
|
||||||
type: 'error',
|
|
||||||
message: 'Can\'t connect to API server.'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
console.error(err)
|
|
||||||
this.setState({
|
|
||||||
alert: {
|
|
||||||
type: 'error',
|
|
||||||
message: err.message
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
switch (this.state.mode) {
|
|
||||||
case DONE_MODE:
|
|
||||||
return (
|
return (
|
||||||
<div className='ContactTab content done'>
|
<div className='ContactTab content'>
|
||||||
<div className='message'>
|
<div className='title'>Contact</div>
|
||||||
<i className='checkIcon fa fa-check-circle'/><br/>
|
<p>
|
||||||
Your message has been sent successfully!!
|
- Issues: <ExternalLink href='https://github.com/BoostIO/Boostnote/issues'>https://github.com/BoostIO/Boostnote/issues</ExternalLink>
|
||||||
</div>
|
</p>
|
||||||
<div className='control'>
|
|
||||||
<button onClick={e => this.handleBackButtonClick(e)}>Back to Contact form</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
case FORM_MODE:
|
|
||||||
default:
|
|
||||||
let alertElement = this.state.alert != null
|
|
||||||
? (
|
|
||||||
<div className={'alert ' + this.state.alert.type}>{this.state.alert.message}</div>
|
|
||||||
)
|
|
||||||
: null
|
|
||||||
return (
|
|
||||||
<div className='ContactTab content form'>
|
|
||||||
<div className='title'>Contact form</div>
|
|
||||||
<div className='description'>
|
|
||||||
Your feedback is highly appreciated and will help us to improve our app. :D
|
|
||||||
</div>
|
|
||||||
<div className='iptGroup'>
|
|
||||||
<input ref='title' valueLink={this.linkState('title')} placeholder='Title' type='text'/>
|
|
||||||
</div>
|
|
||||||
<div className='iptGroup'>
|
|
||||||
<textarea valueLink={this.linkState('content')} placeholder='Content'/>
|
|
||||||
</div>
|
|
||||||
<div className='iptGroup'>
|
|
||||||
<input valueLink={this.linkState('email')} placeholder='E-mail (Optional)' type='email'/>
|
|
||||||
</div>
|
|
||||||
<div className='formControl'>
|
|
||||||
<button onClick={e => this.handleSendButtonClick(e)} className='primary'>Send</button>
|
|
||||||
{alertElement}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
global-reset()
|
global-reset()
|
||||||
@import '../shared/*'
|
@import '../shared/*'
|
||||||
@import './ArticleNavigator'
|
@import './ArticleNavigator'
|
||||||
@import './ArticleTopbar'
|
@import './ArticleTopBar'
|
||||||
@import './ArticleList'
|
@import './ArticleList'
|
||||||
@import './ArticleDetail'
|
@import './ArticleDetail'
|
||||||
@import './modal/*'
|
@import './modal/*'
|
||||||
@@ -126,3 +126,28 @@ textarea.block-input
|
|||||||
margin-left -107px
|
margin-left -107px
|
||||||
&:hover .tooltip
|
&:hover .tooltip
|
||||||
opacity 1
|
opacity 1
|
||||||
|
|
||||||
|
.OSSAnnounceModal
|
||||||
|
height 250
|
||||||
|
text-align center
|
||||||
|
.OSSAnnounceModal-title
|
||||||
|
font-size 32px
|
||||||
|
padding 45px 0
|
||||||
|
|
||||||
|
.OSSAnnounceModal-link
|
||||||
|
display block
|
||||||
|
font-size 20px
|
||||||
|
margin 25px 0 65px
|
||||||
|
.OSSAnnounceModal-closeBtn
|
||||||
|
display block
|
||||||
|
margin 0 auto
|
||||||
|
border none
|
||||||
|
border-radius 5px
|
||||||
|
width 150px
|
||||||
|
height 33px
|
||||||
|
background-color brandColor
|
||||||
|
color white
|
||||||
|
opacity 0.7
|
||||||
|
&:hover
|
||||||
|
opacity 1
|
||||||
|
background-color lighten(brandColor, 10%)
|
||||||
|
|||||||
@@ -177,69 +177,14 @@ iptFocusBorderColor = #369DCD
|
|||||||
color errorTextColor
|
color errorTextColor
|
||||||
background-color errorBackgroundColor
|
background-color errorBackgroundColor
|
||||||
&.ContactTab
|
&.ContactTab
|
||||||
&.done
|
|
||||||
.message
|
|
||||||
margin-top 75px
|
|
||||||
margin-bottom 15px
|
|
||||||
text-align center
|
|
||||||
font-size 22px
|
|
||||||
.checkIcon
|
|
||||||
margin-bottom 15px
|
|
||||||
font-size 144px
|
|
||||||
color brandColor
|
|
||||||
text-align center
|
|
||||||
.control
|
|
||||||
text-align center
|
|
||||||
button
|
|
||||||
border solid 1px borderColor
|
|
||||||
border-radius 5px
|
|
||||||
background-color white
|
|
||||||
padding 15px 15px
|
|
||||||
font-size 14px
|
|
||||||
&:hover
|
|
||||||
background-color darken(white, 10%)
|
|
||||||
&.form
|
|
||||||
padding 10px
|
padding 10px
|
||||||
.title
|
.title
|
||||||
font-size 18px
|
font-size 18px
|
||||||
color brandColor
|
color brandColor
|
||||||
margin-top 10px
|
margin-top 10px
|
||||||
margin-bottom 10px
|
margin-bottom 10px
|
||||||
.description
|
p
|
||||||
margin-bottom 15px
|
line-height 2
|
||||||
.iptGroup
|
|
||||||
margin-bottom 10px
|
|
||||||
input, textarea
|
|
||||||
border-radius 5px
|
|
||||||
border 1px solid borderColor
|
|
||||||
font-size 14px
|
|
||||||
outline none
|
|
||||||
padding 10px 15px
|
|
||||||
width 100%
|
|
||||||
&:focus
|
|
||||||
border-color iptFocusBorderColor
|
|
||||||
textarea
|
|
||||||
resize vertical
|
|
||||||
min-height 150px
|
|
||||||
.formControl
|
|
||||||
clearfix()
|
|
||||||
.alert
|
|
||||||
float right
|
|
||||||
padding 10px 15px
|
|
||||||
margin 0 5px 0
|
|
||||||
font-size 14px
|
|
||||||
line-height normal
|
|
||||||
button
|
|
||||||
padding 10px 15px
|
|
||||||
background-color brandColor
|
|
||||||
color white
|
|
||||||
font-size 14px
|
|
||||||
border-radius 5px
|
|
||||||
border none
|
|
||||||
float right
|
|
||||||
&:hover
|
|
||||||
background-color lighten(brandColor, 10%)
|
|
||||||
|
|
||||||
&.AppSettingTab
|
&.AppSettingTab
|
||||||
.description
|
.description
|
||||||
marked()
|
marked()
|
||||||
|
|||||||
60
gruntfile.js
60
gruntfile.js
@@ -29,10 +29,29 @@ module.exports = function (grunt) {
|
|||||||
certificatePassword: WIN_CERT_PASSWORD,
|
certificatePassword: WIN_CERT_PASSWORD,
|
||||||
noMsi: true
|
noMsi: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'electron-installer-debian': {
|
||||||
|
app: {
|
||||||
|
options: {
|
||||||
|
productName: 'Boostnote',
|
||||||
|
productDescription: 'The opensource note app for developer.',
|
||||||
|
arch: 'amd64',
|
||||||
|
categories: [
|
||||||
|
'Development',
|
||||||
|
'Utility'
|
||||||
|
],
|
||||||
|
icon: path.join(__dirname, 'resources/app.png'),
|
||||||
|
bin: 'Boostnote'
|
||||||
|
},
|
||||||
|
src: path.join(__dirname, 'dist', 'Boostnote-linux-x64'),
|
||||||
|
dest: path.join(__dirname, 'dist')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
grunt.initConfig(initConfig)
|
grunt.initConfig(initConfig)
|
||||||
grunt.loadNpmTasks('grunt-electron-installer')
|
grunt.loadNpmTasks('grunt-electron-installer')
|
||||||
|
grunt.loadNpmTasks('grunt-electron-installer-debian')
|
||||||
|
|
||||||
grunt.registerTask('compile', function () {
|
grunt.registerTask('compile', function () {
|
||||||
var done = this.async()
|
var done = this.async()
|
||||||
@@ -115,6 +134,21 @@ module.exports = function (grunt) {
|
|||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
case 'linux':
|
||||||
|
Object.assign(opts, {
|
||||||
|
platform: 'linux',
|
||||||
|
icon: path.join(__dirname, 'resources/app.icns'),
|
||||||
|
'app-category-type': 'public.app-category.developer-tools'
|
||||||
|
})
|
||||||
|
packager(opts, function (err, appPath) {
|
||||||
|
if (err) {
|
||||||
|
grunt.log.writeln(err)
|
||||||
|
done(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -180,10 +214,22 @@ module.exports = function (grunt) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
grunt.registerTask('build', function (platform) {
|
function getTarget () {
|
||||||
if (!platform) {
|
switch (process.platform) {
|
||||||
platform = process.platform === 'darwin' ? 'osx' : process.platform === 'win32' ? 'win' : null
|
case 'darwin':
|
||||||
|
return 'osx'
|
||||||
|
case 'win32':
|
||||||
|
return 'win'
|
||||||
|
case 'linux':
|
||||||
|
return 'linux'
|
||||||
|
default:
|
||||||
|
return process.platform
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
grunt.registerTask('build', function (platform) {
|
||||||
|
if (platform == null) platform = getTarget()
|
||||||
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'win':
|
case 'win':
|
||||||
grunt.task.run(['compile', 'pack:win', 'create-windows-installer'])
|
grunt.task.run(['compile', 'pack:win', 'create-windows-installer'])
|
||||||
@@ -191,13 +237,15 @@ module.exports = function (grunt) {
|
|||||||
case 'osx':
|
case 'osx':
|
||||||
grunt.task.run(['compile', 'pack:osx', 'codesign', 'create-osx-installer', 'zip:osx'])
|
grunt.task.run(['compile', 'pack:osx', 'codesign', 'create-osx-installer', 'zip:osx'])
|
||||||
break
|
break
|
||||||
|
case 'linux':
|
||||||
|
grunt.task.run(['compile', 'pack:linux', 'electron-installer-debian'])
|
||||||
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
grunt.registerTask('pre-build', function (platform) {
|
grunt.registerTask('pre-build', function (platform) {
|
||||||
if (!platform) {
|
if (platform == null) platform = getTarget()
|
||||||
platform = process.platform === 'darwin' ? 'osx' : process.platform === 'win32' ? 'win' : null
|
|
||||||
}
|
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'win':
|
case 'win':
|
||||||
grunt.task.run(['compile', 'pack:win'])
|
grunt.task.run(['compile', 'pack:win'])
|
||||||
|
|||||||
@@ -16,14 +16,11 @@ var finderProcess = null
|
|||||||
var finderWindow = null
|
var finderWindow = null
|
||||||
var update = null
|
var update = null
|
||||||
|
|
||||||
// app.on('window-all-closed', function () {
|
|
||||||
// if (process.platform !== 'darwin') app.quit()
|
|
||||||
// })
|
|
||||||
|
|
||||||
const appRootPath = path.join(process.execPath, '../..')
|
const appRootPath = path.join(process.execPath, '../..')
|
||||||
const updateDotExePath = path.join(appRootPath, 'Update.exe')
|
const updateDotExePath = path.join(appRootPath, 'Update.exe')
|
||||||
const exeName = path.basename(process.execPath)
|
const exeName = path.basename(process.execPath)
|
||||||
|
|
||||||
|
// For windows app
|
||||||
function spawnUpdate (args, cb) {
|
function spawnUpdate (args, cb) {
|
||||||
var stdout = ''
|
var stdout = ''
|
||||||
var updateProcess = null
|
var updateProcess = null
|
||||||
@@ -128,10 +125,13 @@ const updater = new GhReleases(ghReleasesOpts)
|
|||||||
// Check for updates
|
// Check for updates
|
||||||
// `status` returns true if there is a new update available
|
// `status` returns true if there is a new update available
|
||||||
function checkUpdate () {
|
function checkUpdate () {
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
return true
|
||||||
|
}
|
||||||
updater.check((err, status) => {
|
updater.check((err, status) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
var isLatest = err.message === 'There is no newer version.'
|
||||||
if (!versionNotified) notify('Updater error!', message)
|
if (!isLatest && !versionNotified) notify('Updater error!', err.message)
|
||||||
}
|
}
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (status) {
|
if (status) {
|
||||||
@@ -159,15 +159,6 @@ nodeIpc.config.id = 'node'
|
|||||||
nodeIpc.config.retry = 1500
|
nodeIpc.config.retry = 1500
|
||||||
nodeIpc.config.silent = true
|
nodeIpc.config.silent = true
|
||||||
|
|
||||||
function spawnFinder() {
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
var finderArgv = [path.join(__dirname, 'finder-app.js'), '--finder']
|
|
||||||
if (_.find(process.argv, a => a === '--hot')) finderArgv.push('--hot')
|
|
||||||
finderProcess = ChildProcess
|
|
||||||
.execFile(process.execPath, finderArgv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeIpc.serve(
|
nodeIpc.serve(
|
||||||
path.join(app.getPath('userData'), 'boost.service'),
|
path.join(app.getPath('userData'), 'boost.service'),
|
||||||
function () {
|
function () {
|
||||||
@@ -184,7 +175,7 @@ nodeIpc.serve(
|
|||||||
'message',
|
'message',
|
||||||
function (data, socket) {
|
function (data, socket) {
|
||||||
console.log('>>', data)
|
console.log('>>', data)
|
||||||
format(data)
|
handleIpcEvent(data)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
nodeIpc.server.on(
|
nodeIpc.server.on(
|
||||||
@@ -196,14 +187,18 @@ nodeIpc.serve(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
function format (payload) {
|
function handleIpcEvent (payload) {
|
||||||
switch (payload.type) {
|
switch (payload.type) {
|
||||||
case 'show-main-window':
|
case 'show-main-window':
|
||||||
if (process.platform === 'darwin') {
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
mainWindow.show()
|
mainWindow.show()
|
||||||
} else {
|
case 'win32':
|
||||||
mainWindow.minimize()
|
mainWindow.minimize()
|
||||||
mainWindow.restore()
|
mainWindow.restore()
|
||||||
|
case 'linux':
|
||||||
|
// Do nothing
|
||||||
|
// due to bug of `app.focus()` some desktop Env
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'copy-finder':
|
case 'copy-finder':
|
||||||
@@ -215,6 +210,15 @@ function format (payload) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function spawnFinder() {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
var finderArgv = [path.join(__dirname, 'finder-app.js'), '--finder']
|
||||||
|
if (_.find(process.argv, a => a === '--hot')) finderArgv.push('--hot')
|
||||||
|
finderProcess = ChildProcess
|
||||||
|
.execFile(process.execPath, finderArgv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function quitApp () {
|
function quitApp () {
|
||||||
appQuit = true
|
appQuit = true
|
||||||
if (finderProcess) finderProcess.kill()
|
if (finderProcess) finderProcess.kill()
|
||||||
@@ -223,7 +227,6 @@ function quitApp () {
|
|||||||
|
|
||||||
app.on('ready', function () {
|
app.on('ready', function () {
|
||||||
app.on('before-quit', function () {
|
app.on('before-quit', function () {
|
||||||
console.log('before quite')
|
|
||||||
appQuit = true
|
appQuit = true
|
||||||
if (finderProcess) finderProcess.kill()
|
if (finderProcess) finderProcess.kill()
|
||||||
})
|
})
|
||||||
@@ -244,7 +247,7 @@ app.on('ready', function () {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
var menu = Menu.buildFromTemplate(template)
|
var menu = Menu.buildFromTemplate(template)
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin' || process.platform === 'linux') {
|
||||||
Menu.setApplicationMenu(menu)
|
Menu.setApplicationMenu(menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,25 +269,26 @@ app.on('ready', function () {
|
|||||||
checkUpdate()
|
checkUpdate()
|
||||||
|
|
||||||
mainWindow = require('./main-window')
|
mainWindow = require('./main-window')
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
mainWindow.setMenu(menu)
|
mainWindow.setMenu(menu)
|
||||||
}
|
}
|
||||||
mainWindow.on('close', function (e) {
|
mainWindow.on('close', function (e) {
|
||||||
if (appQuit) return true
|
app.quit()
|
||||||
e.preventDefault()
|
|
||||||
mainWindow.hide()
|
|
||||||
})
|
})
|
||||||
|
switch (process.platform) {
|
||||||
if (finderProcess == null && process.platform === 'darwin') {
|
case 'darwin':
|
||||||
spawnFinder()
|
spawnFinder()
|
||||||
} else {
|
break
|
||||||
|
case 'win32':
|
||||||
finderWindow = require('./finder-window')
|
finderWindow = require('./finder-window')
|
||||||
|
|
||||||
finderWindow.on('close', function (e) {
|
finderWindow.on('close', function (e) {
|
||||||
if (appQuit) return true
|
if (appQuit) return true
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
finderWindow.hide()
|
finderWindow.hide()
|
||||||
})
|
})
|
||||||
|
break
|
||||||
|
case 'linux':
|
||||||
|
// Do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeIpc.server.start(function (err) {
|
nodeIpc.server.start(function (err) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const mainWindow = require('./main-window')
|
|||||||
|
|
||||||
const OSX = process.platform === 'darwin'
|
const OSX = process.platform === 'darwin'
|
||||||
const WIN = process.platform === 'win32'
|
const WIN = process.platform === 'win32'
|
||||||
|
const LINUX = process.platform === 'linux'
|
||||||
|
|
||||||
var boost = {
|
var boost = {
|
||||||
label: 'Boostnote',
|
label: 'Boostnote',
|
||||||
@@ -58,23 +59,6 @@ var file = {
|
|||||||
mainWindow.webContents.send('nav-new-folder')
|
mainWindow.webContents.send('nav-new-folder')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// type: 'separator'
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'Save Post',
|
|
||||||
// accelerator: OSX ? 'Command + S' : 'Control + S',
|
|
||||||
// click: function () {
|
|
||||||
// mainWindow.webContents.send('detail-save')
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// label: 'Save All Posts',
|
|
||||||
// accelerator: OSX ? 'Command + Shift + S' : 'Control + Shift + S',
|
|
||||||
// click: function () {
|
|
||||||
// mainWindow.webContents.send('top-save-all')
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
type: 'separator'
|
type: 'separator'
|
||||||
},
|
},
|
||||||
@@ -88,6 +72,19 @@ var file = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LINUX) {
|
||||||
|
file.submenu.push({
|
||||||
|
type: 'separator'
|
||||||
|
})
|
||||||
|
file.submenu.push({
|
||||||
|
label: 'Quit Boostnote',
|
||||||
|
accelerator: 'Control + Q',
|
||||||
|
click: function () {
|
||||||
|
mainWindow.close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var edit = {
|
var edit = {
|
||||||
label: 'Edit',
|
label: 'Edit',
|
||||||
submenu: [
|
submenu: [
|
||||||
@@ -201,4 +198,6 @@ var help = {
|
|||||||
|
|
||||||
module.exports = process.platform === 'darwin'
|
module.exports = process.platform === 'darwin'
|
||||||
? [boost, file, edit, view, window, help]
|
? [boost, file, edit, view, window, help]
|
||||||
|
: process.platform === 'win32'
|
||||||
|
? [file, view, help]
|
||||||
: [file, view, help]
|
: [file, view, help]
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ var mainWindow = new BrowserWindow({
|
|||||||
zoomFactor: 1.0,
|
zoomFactor: 1.0,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
blinkFeatures: 'OverlayScrollbars'
|
blinkFeatures: 'OverlayScrollbars'
|
||||||
},
|
}
|
||||||
standardWindow: false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const url = path.resolve(__dirname, './main.html')
|
const url = path.resolve(__dirname, './main.html')
|
||||||
|
|||||||
13
package.json
13
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "boost",
|
"name": "boost",
|
||||||
"version": "0.5.5",
|
"version": "0.5.9",
|
||||||
"description": "Boostnote",
|
"description": "Boostnote",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/Rokt33r/codexen-app.git"
|
"url": "git+https://github.com/BoostIO/Boostnote.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"boostnote",
|
"boostnote",
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
"storage",
|
"storage",
|
||||||
"electron"
|
"electron"
|
||||||
],
|
],
|
||||||
"author": "Dick Choi <fluke8259@gmail.com> (http://kazup.co)",
|
"author": "Dick Choi <fluke8259@gmail.com> (https://github.com/Rokt33r)",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/Rokt33r/codexen-app/issues"
|
"url": "https://github.com/BoostIO/Boostnote/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/Rokt33r/codexen-app#readme",
|
"homepage": "https://b00st.io",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rokt33r/node-ipc": "^5.0.4",
|
"@rokt33r/node-ipc": "^5.0.4",
|
||||||
"@rokt33r/sanitize-html": "^1.11.2",
|
"@rokt33r/sanitize-html": "^1.11.2",
|
||||||
@@ -55,11 +55,12 @@
|
|||||||
"babel-preset-react": "^6.3.13",
|
"babel-preset-react": "^6.3.13",
|
||||||
"babel-preset-react-hmre": "^1.0.1",
|
"babel-preset-react-hmre": "^1.0.1",
|
||||||
"css-loader": "^0.19.0",
|
"css-loader": "^0.19.0",
|
||||||
"electron-packager": "^5.1.0",
|
"electron-packager": "^6.0.0",
|
||||||
"electron-prebuilt": "^0.36.11",
|
"electron-prebuilt": "^0.36.11",
|
||||||
"electron-release": "^2.2.0",
|
"electron-release": "^2.2.0",
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-electron-installer": "^1.2.0",
|
"grunt-electron-installer": "^1.2.0",
|
||||||
|
"grunt-electron-installer-debian": "^0.2.0",
|
||||||
"history": "^1.17.0",
|
"history": "^1.17.0",
|
||||||
"nib": "^1.1.0",
|
"nib": "^1.1.0",
|
||||||
"react": "^0.14.3",
|
"react": "^0.14.3",
|
||||||
|
|||||||
@@ -10,6 +10,13 @@ This is a public Kanban board. Also everyone can comment here.
|
|||||||
|
|
||||||
If you want to join us, ask me to add you.
|
If you want to join us, ask me to add you.
|
||||||
|
|
||||||
|
## Live coding
|
||||||
|
|
||||||
|
I've been broadcasting my work. You can check it from the below links. :smile:
|
||||||
|
|
||||||
|
- [Live Stream](https://www.livecoding.tv/rokt33r/videos/)
|
||||||
|
- [Recorded Videos](https://www.livecoding.tv/rokt33r/videos/)
|
||||||
|
|
||||||
## Develop
|
## Develop
|
||||||
|
|
||||||
1. turn on HMR server
|
1. turn on HMR server
|
||||||
|
|||||||
Reference in New Issue
Block a user