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

Add isEqual and changing haveToSaveNotif method

This commit is contained in:
Paul Rosset
2017-12-14 12:26:05 +00:00
parent cb59458c79
commit 795fe8ae1d
3 changed files with 5 additions and 5 deletions

View File

@@ -72,7 +72,7 @@ class HotkeyTab extends React.Component {
this.setState({
config
})
if (JSON.stringify(this.oldHotkey) === JSON.stringify(config.hotkey)) {
if (_.isEqual(this.oldHotkey, config.hotkey)) {
this.props.haveToSave()
} else {
this.props.haveToSave({

View File

@@ -93,7 +93,7 @@ class UiTab extends React.Component {
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => {
const {ui, editor, preview} = this.props.config
this.currentConfig = {ui, editor, preview}
if (JSON.stringify(this.currentConfig) === JSON.stringify(this.state.config)) {
if (_.isEqual(this.currentConfig, this.state.config)) {
this.props.haveToSave()
} else {
this.props.haveToSave({

View File

@@ -98,9 +98,9 @@ class Preferences extends React.Component {
return node.getBoundingClientRect()
}
haveToSaveNotif (tab) {
haveToSaveNotif (type, message) {
return (
<p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p>
<p styleName={`saving--${type}`}>{message}</p>
)
}
@@ -129,7 +129,7 @@ class Preferences extends React.Component {
<span styleName='nav-button-label'>
{tab.label}
</span>
{isUiHotkeyTab ? this.haveToSaveNotif(tab) : null}
{isUiHotkeyTab ? this.haveToSaveNotif(tab[tab.label].type, tab[tab.label].message) : null}
</button>
)
})