mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Correction UiTab
This commit is contained in:
@@ -63,7 +63,7 @@ class StatusBar extends React.Component {
|
|||||||
{status.updateReady
|
{status.updateReady
|
||||||
? <button onClick={this.updateApp} styleName='update'>
|
? <button onClick={this.updateApp} styleName='update'>
|
||||||
<i styleName='update-icon' className='fa fa-cloud-download' /> Ready to Update!
|
<i styleName='update-icon' className='fa fa-cloud-download' /> Ready to Update!
|
||||||
</button>
|
</button>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ class HotkeyTab extends React.Component {
|
|||||||
this.props.haveToSave(null)
|
this.props.haveToSave(null)
|
||||||
} else {
|
} else {
|
||||||
this.props.haveToSave({
|
this.props.haveToSave({
|
||||||
tab: "Hotkey",
|
tab: 'Hotkey',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'You have to save!'
|
message: 'You have to save!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,16 +38,12 @@ class UiTab extends React.Component {
|
|||||||
message: err.message != null ? err.message : 'Error occurs!'
|
message: err.message != null ? err.message : 'Error occurs!'
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
if (JSON.parse(localStorage.getItem('config'))) {
|
|
||||||
const {ui, editor, preview} = JSON.parse(localStorage.getItem('config'))
|
|
||||||
this.currentConfig = {ui, editor, preview}
|
|
||||||
}
|
|
||||||
ipc.addListener('APP_SETTING_DONE', this.handleSettingDone)
|
ipc.addListener('APP_SETTING_DONE', this.handleSettingDone)
|
||||||
ipc.addListener('APP_SETTING_ERROR', this.handleSettingError)
|
ipc.addListener('APP_SETTING_ERROR', this.handleSettingError)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount () {
|
componentWillMount () {
|
||||||
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
|
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
@@ -96,18 +92,20 @@ class UiTab extends React.Component {
|
|||||||
if (newCodemirrorTheme !== codemirrorTheme) {
|
if (newCodemirrorTheme !== codemirrorTheme) {
|
||||||
checkHighLight.setAttribute('href', `../node_modules/codemirror/theme/${newCodemirrorTheme.split(' ')[0]}.css`)
|
checkHighLight.setAttribute('href', `../node_modules/codemirror/theme/${newCodemirrorTheme.split(' ')[0]}.css`)
|
||||||
}
|
}
|
||||||
|
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => {
|
||||||
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme },
|
if (JSON.parse(localStorage.getItem('config'))) {
|
||||||
() => {
|
const {ui, editor, preview} = JSON.parse(localStorage.getItem('config'))
|
||||||
|
this.currentConfig = {ui, editor, preview}
|
||||||
if (JSON.stringify(this.currentConfig) === JSON.stringify(this.state.config)) {
|
if (JSON.stringify(this.currentConfig) === JSON.stringify(this.state.config)) {
|
||||||
this.props.haveToSave(null)
|
this.props.haveToSave(null)
|
||||||
} else {
|
} else {
|
||||||
this.props.haveToSave({
|
this.props.haveToSave({
|
||||||
tab: "UI",
|
tab: 'UI',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'You have to save!'
|
message: 'You have to save!'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ class Preferences extends React.Component {
|
|||||||
|
|
||||||
const navButtons = tabs.map((tab) => {
|
const navButtons = tabs.map((tab) => {
|
||||||
const isActive = this.state.currentTab === tab.target
|
const isActive = this.state.currentTab === tab.target
|
||||||
const isOk = typeof tab[tab.label] !== "undefined" && tab[tab.label] !== null
|
const isOk = typeof tab[tab.label] !== 'undefined' && tab[tab.label] !== null
|
||||||
return (
|
return (
|
||||||
<button styleName={isActive
|
<button styleName={isActive
|
||||||
? 'nav-button--active'
|
? 'nav-button--active'
|
||||||
@@ -123,9 +123,7 @@ class Preferences extends React.Component {
|
|||||||
<span styleName='nav-button-label'>
|
<span styleName='nav-button-label'>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
</span>
|
</span>
|
||||||
{isOk && tab.label === tab[tab.label].tab
|
{isOk && tab.label === tab[tab.label].tab ? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p> : null}
|
||||||
? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p>
|
|
||||||
: null}
|
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user