mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 18:56:22 +00:00
Add isEqual and changing haveToSaveNotif method
This commit is contained in:
@@ -72,7 +72,7 @@ class HotkeyTab extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
config
|
config
|
||||||
})
|
})
|
||||||
if (JSON.stringify(this.oldHotkey) === JSON.stringify(config.hotkey)) {
|
if (_.isEqual(this.oldHotkey, config.hotkey)) {
|
||||||
this.props.haveToSave()
|
this.props.haveToSave()
|
||||||
} else {
|
} else {
|
||||||
this.props.haveToSave({
|
this.props.haveToSave({
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class UiTab extends React.Component {
|
|||||||
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => {
|
this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => {
|
||||||
const {ui, editor, preview} = this.props.config
|
const {ui, editor, preview} = this.props.config
|
||||||
this.currentConfig = {ui, editor, preview}
|
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()
|
this.props.haveToSave()
|
||||||
} else {
|
} else {
|
||||||
this.props.haveToSave({
|
this.props.haveToSave({
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ class Preferences extends React.Component {
|
|||||||
return node.getBoundingClientRect()
|
return node.getBoundingClientRect()
|
||||||
}
|
}
|
||||||
|
|
||||||
haveToSaveNotif (tab) {
|
haveToSaveNotif (type, message) {
|
||||||
return (
|
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'>
|
<span styleName='nav-button-label'>
|
||||||
{tab.label}
|
{tab.label}
|
||||||
</span>
|
</span>
|
||||||
{isUiHotkeyTab ? this.haveToSaveNotif(tab) : null}
|
{isUiHotkeyTab ? this.haveToSaveNotif(tab[tab.label].type, tab[tab.label].message) : null}
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user