mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Correction UiTab
This commit is contained in:
@@ -79,9 +79,9 @@ class HotkeyTab extends React.Component {
|
||||
this.props.haveToSave(null)
|
||||
} else {
|
||||
this.props.haveToSave({
|
||||
tab: "Hotkey",
|
||||
type: 'warning',
|
||||
message: 'You have to save!'
|
||||
tab: 'Hotkey',
|
||||
type: 'warning',
|
||||
message: 'You have to save!'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,16 +38,12 @@ class UiTab extends React.Component {
|
||||
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_ERROR', this.handleSettingError)
|
||||
}
|
||||
|
||||
componentWillMount () {
|
||||
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
|
||||
CodeMirror.autoLoadMode(ReactCodeMirror, 'javascript')
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
@@ -96,18 +92,20 @@ class UiTab extends React.Component {
|
||||
if (newCodemirrorTheme !== codemirrorTheme) {
|
||||
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)) {
|
||||
this.props.haveToSave(null)
|
||||
} else {
|
||||
this.props.haveToSave({
|
||||
tab: "UI",
|
||||
tab: 'UI',
|
||||
type: 'warning',
|
||||
message: 'You have to save!'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class Preferences extends React.Component {
|
||||
|
||||
const navButtons = tabs.map((tab) => {
|
||||
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 (
|
||||
<button styleName={isActive
|
||||
? 'nav-button--active'
|
||||
@@ -123,9 +123,7 @@ class Preferences extends React.Component {
|
||||
<span styleName='nav-button-label'>
|
||||
{tab.label}
|
||||
</span>
|
||||
{isOk && tab.label === tab[tab.label].tab
|
||||
? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p>
|
||||
: null}
|
||||
{isOk && tab.label === tab[tab.label].tab ? <p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p> : null}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user