1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-02-06 20:41:38 +00:00

hotkey config

This commit is contained in:
Dick Choi
2016-07-22 08:39:25 +09:00
parent a6e3dbd825
commit 40410eb10f
6 changed files with 43 additions and 74 deletions

View File

@@ -37,7 +37,11 @@ button
font-size 12px
&:focus, &.focus
outline none
&:disabled
cursor not-allowed
input
&:disabled
cursor not-allowed
.noSelect
noSelect()

View File

@@ -1,6 +1,8 @@
import _ from 'lodash'
const OSX = global.process.platform === 'darwin'
const electron = require('electron')
const { ipcRenderer } = electron
const defaultConfig = {
zoom: 1,
@@ -64,8 +66,17 @@ function set (updates) {
let newConfig = Object.assign({}, defaultConfig, currentConfig, updates)
if (!validate(newConfig)) throw new Error('INVALID CONFIG')
_save(newConfig)
ipcRenderer.send('CONFIG_RENEW', {
config: get(),
silent: false
})
}
ipcRenderer.send('CONFIG_RENEW', {
config: get(),
silent: true
})
export default {
get,
set,

View File

@@ -25,7 +25,7 @@ class ConfigTab extends React.Component {
this.handleSettingDone = () => {
this.setState({keymapAlert: {
type: 'success',
message: 'Successfully done!'
message: 'Successfully applied!'
}})
}
this.handleSettingError = (err) => {
@@ -43,20 +43,17 @@ class ConfigTab extends React.Component {
ipc.removeListener('APP_SETTING_ERROR', this.handleSettingError)
}
submitHotKey () {
ipc.send('hotkeyUpdated', this.state.keymap)
}
submitConfig () {
ipc.send('configUpdated', this.state.config)
}
handleSaveButtonClick (e) {
this.submitHotKey()
}
let newConfig = {
hotkey: this.state.config.hotkey
}
handleConfigSaveButtonClick (e) {
this.submitConfig()
ConfigManager.set(newConfig)
store.dispatch({
type: 'SET_UI',
config: newConfig
})
}
handleKeyDown (e) {
@@ -183,6 +180,7 @@ class ConfigTab extends React.Component {
ref='toggleFinder'
value={config.hotkey.toggleFinder}
type='text'
disabled
/>
</div>
</div>

View File

@@ -34,6 +34,8 @@
border solid 1px $border-color
border-radius 2px
padding 0 5px
&:disabled
background-color $ui-input--disabled-backgroundColor
.group-checkBoxSection
margin-bottom 15px
@@ -47,6 +49,12 @@
box-sizing border-box
height 40px
text-align right
:global
.alert
font-size 12px
line-height 30px
padding 0 5px
float right
.group-control-leftButton
float left
colorDefaultButton()

View File

@@ -2,9 +2,9 @@ import React, { PropTypes } from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoTab.styl'
const appVersion = global.process.version
const electron = require('electron')
const { shell } = electron
const { shell, remote } = electron
const appVersion = remote.app.getVersion()
class InfoTab extends React.Component {
constructor (props) {