mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
cleanup
This commit is contained in:
@@ -13,16 +13,21 @@ class Detail extends React.Component {
|
|||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.focusHandler = () => {
|
this.focusHandler = () => {
|
||||||
this.refs.root.focus()
|
this.refs.root != null && this.refs.root.focus()
|
||||||
|
}
|
||||||
|
this.deleteHandler = () => {
|
||||||
|
this.refs.root != null && this.refs.root.handleDeleteMenuClick()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
ee.on('detail:focus', this.focusHandler)
|
ee.on('detail:focus', this.focusHandler)
|
||||||
|
ee.on('detail:delete', this.deleteHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
ee.off('detail:focus', this.focusHandler)
|
ee.off('detail:focus', this.focusHandler)
|
||||||
|
ee.off('detail:delete', this.deleteHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
@@ -46,7 +51,6 @@ class Detail extends React.Component {
|
|||||||
<div styleName='root'
|
<div styleName='root'
|
||||||
style={this.props.style}
|
style={this.props.style}
|
||||||
tabIndex='0'
|
tabIndex='0'
|
||||||
ref='root'
|
|
||||||
>
|
>
|
||||||
<div styleName='empty'>
|
<div styleName='empty'>
|
||||||
<div styleName='empty-message'>{OSX ? 'Command(⌘)' : 'Ctrl(^)'} + N<br/>to create a new post</div>
|
<div styleName='empty-message'>{OSX ? 'Command(⌘)' : 'Ctrl(^)'} + N<br/>to create a new post</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import _ from 'lodash'
|
|||||||
import modal from 'browser/main/lib/modal'
|
import modal from 'browser/main/lib/modal'
|
||||||
import NewNoteModal from 'browser/main/modals/NewNoteModal'
|
import NewNoteModal from 'browser/main/modals/NewNoteModal'
|
||||||
import { hashHistory } from 'react-router'
|
import { hashHistory } from 'react-router'
|
||||||
|
import ee from 'browser/main/lib/eventEmitter'
|
||||||
|
|
||||||
const OSX = window.process.platform === 'darwin'
|
const OSX = window.process.platform === 'darwin'
|
||||||
|
|
||||||
@@ -17,6 +18,18 @@ class TopBar extends React.Component {
|
|||||||
searchOptions: [],
|
searchOptions: [],
|
||||||
searchPopupOpen: false
|
searchPopupOpen: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.newNoteHandler = () => {
|
||||||
|
this.handleNewPostButtonClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
ee.on('top:new-note', this.newNoteHandler)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
ee.off('top:new-note', this.newNoteHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
handleNewPostButtonClick (e) {
|
handleNewPostButtonClick (e) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const ipc = electron.ipcMain
|
|||||||
const Menu = electron.Menu
|
const Menu = electron.Menu
|
||||||
const globalShortcut = electron.globalShortcut
|
const globalShortcut = electron.globalShortcut
|
||||||
const mainWindow = require('./main-window')
|
const mainWindow = require('./main-window')
|
||||||
const nodeIpc = require('@rokt33r/node-ipc')
|
// const nodeIpc = require('@rokt33r/node-ipc')
|
||||||
|
|
||||||
function emitToFinder (type, data) {
|
function emitToFinder (type, data) {
|
||||||
var payload = {
|
var payload = {
|
||||||
@@ -11,7 +11,7 @@ function emitToFinder (type, data) {
|
|||||||
data: data
|
data: data
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeIpc.server.broadcast('message', payload)
|
// nodeIpc.server.broadcast('message', payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleFinder () {
|
function toggleFinder () {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ const autoUpdater = electron.autoUpdater
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const ChildProcess = require('child_process')
|
const ChildProcess = require('child_process')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const nodeIpc = require('@rokt33r/node-ipc')
|
|
||||||
const GhReleases = require('electron-gh-releases')
|
const GhReleases = require('electron-gh-releases')
|
||||||
// electron.crashReporter.start()
|
// electron.crashReporter.start()
|
||||||
|
|
||||||
@@ -154,37 +153,37 @@ updater.on('update-downloaded', (info) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
nodeIpc.config.id = 'node'
|
// nodeIpc.config.id = 'node'
|
||||||
nodeIpc.config.retry = 1500
|
// nodeIpc.config.retry = 1500
|
||||||
nodeIpc.config.silent = true
|
// nodeIpc.config.silent = true
|
||||||
|
|
||||||
nodeIpc.serve(
|
// nodeIpc.serve(
|
||||||
path.join(app.getPath('userData'), 'boost.service'),
|
// path.join(app.getPath('userData'), 'boost.service'),
|
||||||
function () {
|
// function () {
|
||||||
nodeIpc.server.on(
|
// nodeIpc.server.on(
|
||||||
'connect',
|
// 'connect',
|
||||||
function (socket) {
|
// function (socket) {
|
||||||
socket.on('close', function () {
|
// socket.on('close', function () {
|
||||||
console.log('socket dead')
|
// console.log('socket dead')
|
||||||
if (!appQuit) spawnFinder()
|
// if (!appQuit) spawnFinder()
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
nodeIpc.server.on(
|
// nodeIpc.server.on(
|
||||||
'message',
|
// 'message',
|
||||||
function (data, socket) {
|
// function (data, socket) {
|
||||||
console.log('>>', data)
|
// console.log('>>', data)
|
||||||
handleIpcEvent(data)
|
// handleIpcEvent(data)
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
nodeIpc.server.on(
|
// nodeIpc.server.on(
|
||||||
'error',
|
// 'error',
|
||||||
function (err) {
|
// function (err) {
|
||||||
console.log('>>', err)
|
// console.log('>>', err)
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
)
|
// )
|
||||||
|
|
||||||
function handleIpcEvent (payload) {
|
function handleIpcEvent (payload) {
|
||||||
switch (payload.type) {
|
switch (payload.type) {
|
||||||
@@ -303,12 +302,12 @@ app.on('ready', function () {
|
|||||||
// // Do nothing.
|
// // Do nothing.
|
||||||
// }
|
// }
|
||||||
|
|
||||||
nodeIpc.server.start(function (err) {
|
// nodeIpc.server.start(function (err) {
|
||||||
if (err.code === 'EADDRINUSE') {
|
// if (err.code === 'EADDRINUSE') {
|
||||||
notify('Error occurs!', 'You have to kill other Boostnote processes.')
|
// notify('Error occurs!', 'You have to kill other Boostnote processes.')
|
||||||
quitApp()
|
// quitApp()
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
|
|
||||||
require('./hotkey')
|
require('./hotkey')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -49,14 +49,7 @@ var file = {
|
|||||||
label: 'New Post',
|
label: 'New Post',
|
||||||
accelerator: OSX ? 'Command + N' : 'Control + N',
|
accelerator: OSX ? 'Command + N' : 'Control + N',
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.webContents.send('top-new-post')
|
mainWindow.webContents.send('top:new-note')
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'New Folder',
|
|
||||||
accelerator: OSX ? 'Command + Shift + N' : 'Control + Shift + N',
|
|
||||||
click: function () {
|
|
||||||
mainWindow.webContents.send('nav-new-folder')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -66,7 +59,7 @@ var file = {
|
|||||||
label: 'Delete Post',
|
label: 'Delete Post',
|
||||||
accelerator: OSX ? 'Control + Backspace' : 'Control + Delete',
|
accelerator: OSX ? 'Control + Backspace' : 'Control + Delete',
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.webContents.send('detail-delete')
|
mainWindow.webContents.send('detail:delete')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -127,16 +120,6 @@ var edit = {
|
|||||||
var view = {
|
var view = {
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
|
||||||
label: 'Focus Search',
|
|
||||||
accelerator: 'Control + Alt + F',
|
|
||||||
click: function () {
|
|
||||||
mainWindow.webContents.send('top-focus-search')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: (function () {
|
accelerator: (function () {
|
||||||
@@ -192,12 +175,8 @@ var help = {
|
|||||||
click: function () { shell.openExternal('https://b00st.io/') }
|
click: function () { shell.openExternal('https://b00st.io/') }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Tutorial page',
|
label: 'Issue Tracker',
|
||||||
click: function () { shell.openExternal('https://b00st.io/tutorial.html') }
|
click: function () { shell.openExternal('https://github.com/BoostIO/Boostnote/issues') }
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Discussions',
|
|
||||||
click: function () { shell.openExternal('https://github.com/BoostIO/boost-app-discussions/issues') }
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Changelog',
|
label: 'Changelog',
|
||||||
|
|||||||
@@ -38,8 +38,6 @@
|
|||||||
"homepage": "https://b00st.io",
|
"homepage": "https://b00st.io",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rokt33r/markdown-it-math": "^4.0.1",
|
"@rokt33r/markdown-it-math": "^4.0.1",
|
||||||
"@rokt33r/node-ipc": "^5.0.4",
|
|
||||||
"@rokt33r/sanitize-html": "^1.11.2",
|
|
||||||
"ace-builds": "git+https://git@github.com/ajaxorg/ace-builds.git",
|
"ace-builds": "git+https://git@github.com/ajaxorg/ace-builds.git",
|
||||||
"devicon": "^2.0.0",
|
"devicon": "^2.0.0",
|
||||||
"electron-gh-releases": "^2.0.2",
|
"electron-gh-releases": "^2.0.2",
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ var config = {
|
|||||||
'markdown-it-emoji',
|
'markdown-it-emoji',
|
||||||
'fs-jetpack',
|
'fs-jetpack',
|
||||||
'@rokt33r/markdown-it-math',
|
'@rokt33r/markdown-it-math',
|
||||||
'@rokt33r/sanitize-html',
|
|
||||||
'markdown-it-checkbox',
|
'markdown-it-checkbox',
|
||||||
'season',
|
'season',
|
||||||
'devtron',
|
'devtron',
|
||||||
|
|||||||
Reference in New Issue
Block a user