1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

make configurable --disable-direct-write flag

This commit is contained in:
Dick Choi
2016-01-09 21:48:21 +09:00
parent 567f453232
commit 45a46cbc7a
4 changed files with 36 additions and 11 deletions

View File

@@ -78,6 +78,14 @@ export default class AppSettingTab extends React.Component {
} }
} }
handleDisableDirectWriteClick (e) {
let config = this.state.config
config['disable-direct-write'] = !config['disable-direct-write']
this.setState({
config
})
}
handleNameSaveButtonClick (e) { handleNameSaveButtonClick (e) {
let { dispatch } = this.props let { dispatch } = this.props
@@ -156,9 +164,8 @@ export default class AppSettingTab extends React.Component {
{ {
true// !OSX true// !OSX
? ( ? (
<div className='sectionInput'> <div className='sectionCheck'>
<label>Direct write(Windows only)</label> <label><input onClick={e => this.handleDisableDirectWriteClick(e)} checked={this.state.config['disable-direct-write']} disabled={OSX} type='checkbox'/>Disable Direct Write<span className='sectionCheck-warn'>It will be applied after restarting</span></label>
<input disabled={OSX} onKeyDown={e => this.handleConfigKeyDown(e)} type='checkbox'/>
</div> </div>
) )
: null : null

View File

@@ -69,6 +69,18 @@ iptFocusBorderColor = #369DCD
font-size 18px font-size 18px
margin 10px 0 5px margin 10px 0 5px
color brandColor color brandColor
&>.sectionCheck
margin-bottom 5px
height 33px
label
width 150px
padding-left 15px
line-height 33px
.sectionCheck-warn
font-size 12px
margin-left 10px
border-left 2px solid brandColor
padding-left 5px
&>.sectionInput &>.sectionInput
margin-bottom 5px margin-bottom 5px
clearfix() clearfix()

View File

@@ -2,7 +2,6 @@ const electron = require('electron')
const app = electron.app const app = electron.app
const ipc = electron.ipcMain const ipc = electron.ipcMain
const jetpack = require('fs-jetpack') const jetpack = require('fs-jetpack')
const mainWindow = require('./main-window')
const defaultConfig = { const defaultConfig = {
'editor-font-size': '14', 'editor-font-size': '14',
@@ -41,6 +40,12 @@ function saveConfig () {
// Init // Init
global.config = Object.assign({}, defaultConfig, getConfig()) global.config = Object.assign({}, defaultConfig, getConfig())
if (global.config['disable-direct-write']) {
app.commandLine.appendSwitch('disable-direct-write')
}
app.on('ready', function () {
const mainWindow = require('./main-window')
function applyConfig () { function applyConfig () {
mainWindow.webContents.send('config-apply') mainWindow.webContents.send('config-apply')
} }
@@ -50,4 +55,5 @@ ipc.on('configUpdated', function (event, newConfig) {
saveConfig() saveConfig()
applyConfig() applyConfig()
}) })
})

View File

@@ -10,6 +10,7 @@ const nodeIpc = require('@rokt33r/node-ipc')
const GhReleases = require('electron-gh-releases') const GhReleases = require('electron-gh-releases')
// electron.crashReporter.start() // electron.crashReporter.start()
require('./config')
var mainWindow = null var mainWindow = null
var finderProcess = null var finderProcess = null
var finderWindow = null var finderWindow = null
@@ -295,7 +296,6 @@ app.on('ready', function () {
}) })
require('./hotkey') require('./hotkey')
require('./config')
}) })
module.exports = app module.exports = app