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:
@@ -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
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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,13 +40,20 @@ function saveConfig () {
|
|||||||
// Init
|
// Init
|
||||||
global.config = Object.assign({}, defaultConfig, getConfig())
|
global.config = Object.assign({}, defaultConfig, getConfig())
|
||||||
|
|
||||||
function applyConfig () {
|
if (global.config['disable-direct-write']) {
|
||||||
mainWindow.webContents.send('config-apply')
|
app.commandLine.appendSwitch('disable-direct-write')
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.on('configUpdated', function (event, newConfig) {
|
app.on('ready', function () {
|
||||||
global.config = Object.assign({}, defaultConfig, global.config, newConfig)
|
const mainWindow = require('./main-window')
|
||||||
saveConfig()
|
function applyConfig () {
|
||||||
applyConfig()
|
mainWindow.webContents.send('config-apply')
|
||||||
|
}
|
||||||
|
|
||||||
|
ipc.on('configUpdated', function (event, newConfig) {
|
||||||
|
global.config = Object.assign({}, defaultConfig, global.config, newConfig)
|
||||||
|
saveConfig()
|
||||||
|
applyConfig()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user